LeetCode-OpenSource/rxjs-hooks

`useObservable` state generic is incorrectly inferred

OliverJAsh opened this issue · 1 comments

const y = useObservable((input$, state$) => state$, undefined, [1]);
// Actual type: `[number] | undefined`
// Expected type: `undefined`

Only happens when "strictFunctionTypes": false.

Workaround: use explicit generics

const y = useObservable<undefined, [number]>((input$, state$) => state$, undefined, [1]);

PR with fix: #176