chore: comments regarding Readonly usage
This commit is contained in:
@@ -68,6 +68,9 @@ export function watch<T>(
|
||||
): StopHandle
|
||||
|
||||
// overload #3: array of multiple sources + cb
|
||||
// Readonly constraint helps the callback to correctly infer value types based
|
||||
// on position in the source array. Otherwise the values will get a union type
|
||||
// of all possible value types.
|
||||
export function watch<T extends Readonly<WatcherSource<unknown>[]>>(
|
||||
sources: T,
|
||||
cb: WatchHandler<MapSources<T>>,
|
||||
|
||||
Reference in New Issue
Block a user