Typescript "This expression is not callable. Type 'never' has no call signatures."

See original GitHub issue

When 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:closed
  • Created 2 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dai-shicommented, Oct 29, 2021

Maybe, it doesn’t like the use of conditional focusAtom. And/or, optic.path(string) doesn’t seem to type correctly.

1reaction
hoetmaaierscommented, Oct 26, 2021

Thank you @dai-shi , the project was an older one being converted to modern times. Setting strict: true solved the issue.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found