-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Wrong recognized This expression is not callable
#35423
Comments
return [blah, blah] as const; |
Thanks @AnyhowStep Const assertion or make types for function result is a solution. 👍 |
philipp985
added a commit
to philipp985/usehooks
that referenced
this issue
Nov 19, 2020
Based on this thread: microsoft/TypeScript#35423 I had to change the return type to be const to satisfy the typescript compiler
Thanks, this helped. I was using a custom hook for enabling dark mode and got this error. Fixed it by returning the hook state as const. return [darkMode, setDarkMode] as const; |
benadam11
pushed a commit
to uidotdev/usehooks
that referenced
this issue
May 29, 2023
Based on this thread: microsoft/TypeScript#35423 I had to change the return type to be const to satisfy the typescript compiler
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
TypeScript Version: All stable versions in playground (2.4.1 ... 3.7.2)
Search Terms:
This expression is not callable.
Code
Expected behavior:
It should works in any way of return internal function out.
Actual behavior:
This error doesn't makes sense, because if I return just setValue function will work.
Playground Link:
playground
Related Issues:
The text was updated successfully, but these errors were encountered: