I have the following typing :
declare function linkedSignal<S, D>(options: {
source: () => S;
computation: (source: NoInfer<S>, previous?: {source: NoInfer<S>; value: NoInfer<D>}) => D;
}): D;
When using it this way :
linkedSignal({
source: () => 3,
computation: (source, previous) => {
return 3;
},
})
D
is infered as unknown
, even though the computation
function returns a deterministic type.
Can you explain why this is happening and how we could improve the typing so the generic is correctly inferred.