voby icon indicating copy to clipboard operation
voby copied to clipboard

Simplifying the type signature of useResolved

Open FlatMapIO opened this issue 6 months ago • 0 comments

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) => {

})

image

FlatMapIO avatar Jan 14 '24 03:01 FlatMapIO