You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The project is written in plain JavaScript for Node v16 in the ES Modules format (type: module in package.json).
TypeScript is used as a type checking tool built into the VS Code editor. No transpilation takes place. moduleResolution compiler option in tsconfig.json is set to Node16 according to the documentation. Changing this option to node eliminates the error.
I had the same error but I just manually typed the default export:
importalgoliasearch,{AlgoliaSearchOptions,SearchClient}from"algoliasearch";constalgolia=algoliasearchasunknownas(appId: string,apiKey: string,options?: AlgoliaSearchOptions,)=>SearchClient;// All good constagClient=algolia(...);
I know it's not a good solution but I'm not sure what causes this.
👋 Got the same issue here (even when using the lite version algoliasearch/lite)
It seems that the type is wrongly mapped to the default export.
If I remap the default export type it works:
importalgoliasearchfrom"algoliasearch"// Don't work: 'This expression is not callable.'constagClient=algoliasearch(...)// All goodconstagClient=(algoliasearchasunknownas(typeofalgoliasearch)["default"])(...)
The project is written in plain JavaScript for Node v16 in the ES Modules format (
type: module
inpackage.json
).TypeScript is used as a type checking tool built into the VS Code editor. No transpilation takes place.
moduleResolution
compiler option intsconfig.json
is set toNode16
according to the documentation. Changing this option tonode
eliminates the error.Minimal reproducible example: https://gist.github.com/anantakrishna/97250b7726b1d3b7640872f24d6cd5d3
Error:
Note: the code runs properly, the error is affecting only the type checking (intellisense in the editor).
The text was updated successfully, but these errors were encountered: