Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useObservable state generic is incorrectly inferred #171

Closed
OliverJAsh opened this issue Feb 5, 2020 · 1 comment · Fixed by #176
Closed

useObservable state generic is incorrectly inferred #171

OliverJAsh opened this issue Feb 5, 2020 · 1 comment · Fixed by #176

Comments

@OliverJAsh
Copy link
Contributor

OliverJAsh commented Feb 5, 2020

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

Only happens when "strictFunctionTypes": false.

Workaround: use explicit generics

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

PR with fix: #176

lupinthethirdgentleman pushed a commit to lupinthethirdgentleman/react-rxjs-hooks that referenced this issue Aug 5, 2021
Dmytro-Alpha added a commit to Dmytro-Alpha/-react-rxjs-hooks that referenced this issue Jan 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant