Skip to content
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

TypeError: isbot_1.default is not a function #41

Closed
massa-man opened this issue Aug 12, 2019 · 0 comments · Fixed by #42
Closed

TypeError: isbot_1.default is not a function #41

massa-man opened this issue Aug 12, 2019 · 0 comments · Fixed by #42

Comments

@massa-man
Copy link

TS Type Definitions appear to have issues. When upgrading to the latest version, I start getting the following error:

TypeError: isbot_1.default is not a function

After upgrading to 2.4.0, the old way of importing the library in TS started throwing errors in the TS compiler:

import * as isBot from 'isbot';

Now generates the following error:

Cannot invoke an expression whose type lacks a call signature. Type 'typeof import("node_modules/isbot/index")' has no compatible call signatures.ts(2349)

To remove the TS compiler error, I had to change the import to:

import isBot from 'isbot';

But this now throws a runtime error (compilation works OK), as follows:

TypeError: isbot_1.default is not a function

I can see that the main change from the previous version I was using (v2.1.2) is the addition of the type defs (.d.ts) file in the package.

I have done some research, and this kind of error usually is linked to invalid TS definition files. Some similar issues found on the web, with packages having similar problems:

microsoft/TypeScript#7554
iamkun/dayjs#475

My current tsconfig.json file is:

  "compilerOptions": {
    "target": "es2016",
    "module": "commonjs",
    "strict": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "sourceMap": true,
    "types": ["node", "aws-lambda"]
  }
}

And environment:

isbot: 2.4.0
node: 10
typescript: 3.5.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant