voby
voby copied to clipboard
Simplifying the type signature of useResolved
I tested the following type signature, and it correctly inferred the list of variable parameter types, so maybe we can use it to simplify the signature of the useResolved function.
function resolve<
T extends unknown[],
R extends {
[K in keyof T]: T[K] extends Observable<infer V> ? V : T[K] extends () => infer V ? V : T[K]
},
>(vals: [...T], fn: (...args: [...R]) => void) {
}
resolve([$(1), $('2'), 3, () => 4], (_1, _2,_3, _4) => {
})