Skip to content

Commit 2cdebd5

Browse files
authored
Merge pull request #210 from amir-arad/patch-1
Fix onChange return type in StateCallbacks.ts
2 parents 9d968e0 + de72dfa commit 2cdebd5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/decoder/strategy/StateCallbacks.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,9 @@ export type CollectionCallback<K, V> = {
9494
* If you want to listen to changes on individual items, you need to attach callbacks to the them directly inside the `onAdd` callback.
9595
*
9696
* @param callback
97+
* @return callback to detach the onChange listener
9798
*/
98-
onChange(callback: (item: V, index: K) => void): void;
99+
onChange(callback: (item: V, index: K) => void): () => void;
99100
};
100101

101102
type OnInstanceAvailableCallback = (callback: (ref: Ref, existing: boolean) => void) => void;
@@ -433,4 +434,4 @@ export function getDecoderStateCallbacks<T extends Schema>(decoder: Decoder<T>):
433434
}
434435

435436
return $;
436-
}
437+
}

0 commit comments

Comments
 (0)