Typescript "This expression is not callable. Type 'never' has no call signatures."
See original GitHub issueWhen letting Typescript derive the type from useAtom, it warns me with the message “This expression is not callable. Type ‘never’ has no call signatures.”.
This is a code example:
interface CitySelection {
title: string;
}
const citySelectionAtom = atom<CitySelection>(null);
When used in a component, the Setter is type as never:
const [citySelection, setCitySelection] = useAtom(citySelectionAtom);
calling setCitySelection triggers the Typescript warning because it’s automatically inferred type is never.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
This expression is not callable Type 'String' has no call ...
setIssuerCallState is a function, so setting it as string will give you the error String' has no call signatures. Try setting the type...
Read more >Documentation - TypeScript 3.3
Cannot invoke an expression whose type lacks a call signature. // Type 'FruitEater | ColorConsumer' has no compatible call signatures.ts(2349). f("orange");.
Read more >ts2349: this expression is not callable. type 'void' has no call ...
To solve the "This expression is not callable. Type 'String' has no call signatures" TypeScript error: Make sure the value you are calling...
Read more >Typescript express-jwt - This expression is not callable Error
... exception stating that jwt() This expression is not callable. and node_modules/express-jwt/dist/index"' has no call signatures.ts(2349).
Read more >This expression is not callable. Type 'Thunk<Collections ...
Coding example for the question This expression is not callable. Type 'Thunk ' has no call signatures-Reactjs.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Maybe, it doesn’t like the use of conditional
focusAtom. And/or,optic.path(string)doesn’t seem to type correctly.Thank you @dai-shi , the project was an older one being converted to modern times. Setting
strict: truesolved the issue.