-
Notifications
You must be signed in to change notification settings - Fork 215
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
algoliasearch
is not callable when moduleResolution
is Node16
#1431
Comments
I had the same error but I just manually typed the default export: import algoliasearch, { AlgoliaSearchOptions, SearchClient } from "algoliasearch";
const algolia = algoliasearch as unknown as (
appId: string,
apiKey: string,
options?: AlgoliaSearchOptions,
) => SearchClient;
// All good
const agClient = 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 If I remap the default export type it works: import algoliasearch from "algoliasearch"
// Don't work: 'This expression is not callable.'
const agClient = algoliasearch(...)
// All good
const agClient = (algoliasearch as unknown as (typeof algoliasearch)["default"])(...) |
https://arethetypeswrong.github.io/?p=algoliasearch%404.17.1 |
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: