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

v8n import typescript - has no call signatures #236

Open
stefanwerfling opened this issue Mar 24, 2023 · 5 comments
Open

v8n import typescript - has no call signatures #236

stefanwerfling opened this issue Mar 24, 2023 · 5 comments
Assignees
Labels
Note: Help Wanted Scope: Build Status: Reproduction Needed This issue requires reproduction code to address.

Comments

@stefanwerfling
Copy link

I've been trying to integrate the v8n into my project for a few days now. But that fails once when typescript is compiled with the import or with the call of v8n().

TS2349: This expression is not callable.   Type 'typeof import("/node_modules/v8n/types/index")' has no call signatures.

I have now tried the following:
import v8n from 'v8n';

v8n().number()

or

v8n.default().number()

This allows Typescript and then translates it into Javascript but when you start in nodejs the object is not found on "default".

My tsconfig:

{
  "compileOnSave": true,
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "module": "NodeNext",
    "target": "ES2022",
    "strict": true,
    "baseUrl": "./",
    "outDir": "dist",
    "sourceMap": true,
    "removeComments": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "importHelpers": true,
    "esModuleInterop": true,
    "types": [
      "node"
    ],
    "typeRoots": [
      "node_modules/@types"
    ]
  },
  "include": [
    "./src/**/*.ts"
  ]
}

Does it have to be imported differently? Or is that a bug?

@imbrn
Copy link
Owner

imbrn commented Mar 24, 2023

Hello, @stefanwerfling. Thank you for reporting this issue. I'll check that as soon as possible and let you know about any updates.

@imbrn imbrn self-assigned this Mar 24, 2023
@imbrn
Copy link
Owner

imbrn commented Mar 25, 2023

HEY @stefanwerfling , I hope you're doing well today :)

Can you share the NodeJS and Typescript versions you are using, please?

@imbrn imbrn added Note: Help Wanted Status: Reproduction Needed This issue requires reproduction code to address. labels Mar 25, 2023
@stefanwerfling
Copy link
Author

Hey @imbrn, thank you! :)

I use Node.js v14.21.2 or in docker FROM node:18-bullseye.
By Typescript i use:

"@typescript-eslint/eslint-plugin": "^5.56.0", "@typescript-eslint/parser": "^5.56.0", "eslint": "^8.36.0", "eslint-plugin-prefer-arrow": "^1.2.3", "tslib": "^2.5.0", "tslint": "^6.1.3", "typescript": "^4.9.5"

I Hope you can found the problem!

@imbrn
Copy link
Owner

imbrn commented Apr 1, 2023

Hello @stefanwerfling , thank you for sharing your configs.

I'm trying to reproduce the error in a few ways, but I couldn't get the mentioned problem to occur on my machine.
I'm using the same configuration as yours, except that I'm using my local environment instead of a docker container.

Could you reproduce this problem using some shareable online service like Codesandbox or something similar? Maybe I have some different configurations here on my local project.

Have a good one.

@stefanwerfling
Copy link
Author

Hello @imbrn, I work with phpstorm as IDE. The IDE can not usw

import v8n from "v8n";

and change it to import with umd.

then the error comes in the docker container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Note: Help Wanted Scope: Build Status: Reproduction Needed This issue requires reproduction code to address.
Projects
None yet
Development

No branches or pull requests

2 participants