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

Import error when use type module on package.json #2217

Closed
Pnlvfx opened this issue Aug 28, 2024 · 11 comments
Closed

Import error when use type module on package.json #2217

Pnlvfx opened this issue Aug 28, 2024 · 11 comments
Labels
needs more info not enough information in issue to debug stale no activity for 2 weeks

Comments

@Pnlvfx
Copy link

Pnlvfx commented Aug 28, 2024

This expression is not callable.
Type 'typeof import("/Users/simo97/Desktop/web/tiktok-downloader/node_modules/nodemon/index")' has no call signatures.ts(2349)

I'm using latest version but it happeng from 3.1.0, as no one has reported it before, I will do it.

@Pnlvfx
Copy link
Author

Pnlvfx commented Aug 28, 2024

Typescript tell you to use nodemon.default, but then when starting nodemon, node will throw an error as nodemon.default is not a function, so there is something wrong between types and export

Copy link

This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up.
Thank you for contributing <3

@github-actions github-actions bot added the stale no activity for 2 weeks label Sep 11, 2024
@Pnlvfx
Copy link
Author

Pnlvfx commented Sep 16, 2024

type: 'module'
devDependency: {
"nodemon": "^3.1.4",
}

nodemon({
script: './dist/server.js',
ext: 'js',
exec: NGROK_URL=${url} node,
})

This expression is not callable.
Type 'typeof import("/Users/simo97/Desktop/web/node_modules/nodemon/index")' has no call signatures.ts(2349)

@github-actions github-actions bot removed the stale no activity for 2 weeks label Sep 16, 2024
@remy
Copy link
Owner

remy commented Sep 16, 2024

I don't know what that means. Can you provide a git repo to help understand and replicate (note that I don't generally use typescript so assume you'll have to be clear in your instructions)

@remy remy added the needs more info not enough information in issue to debug label Sep 16, 2024
@Pnlvfx
Copy link
Author

Pnlvfx commented Sep 20, 2024

I understand, it's the same for me when I look at your project, I start coding using typescript and I never used module exports and stuff like that, so I really don't know how to help you, however, I think you know the difference between commonjs and esmodule.

import statements of .js files are treated as ES modules if the nearest parent package.json contains "type": "module".

Importing nodemon with type: module in a package.json will throw a typescript import error.

This expression is not callable.
Type 'typeof import("/Users/simo97/Desktop/web/sports/api-jupiter/node_modules/nodemon/index")' has no call signatures.ts(2349)

I've seen that in the latest versions (I don't remember exactly which one) you include the @types in the repository, I strongly think that the error arises for that, however I'm not sure.

I'm sorry but I have no time to provide a repro, however you can just create a new typescript project and use type: module on your package.json and the error will appear.

@Pnlvfx
Copy link
Author

Pnlvfx commented Sep 20, 2024

I don't know what that means. Can you provide a git repo to help understand and replicate (note that I don't generally use typescript so assume you'll have to be clear in your instructions)

Sorry, but I have just seen that there is a pull request that address this issue,

#2211

@remy
Copy link
Owner

remy commented Sep 20, 2024

I've just merged that pr. Since it was provided by someone else it didn't come with tests, so I can't be entirely sure it does what helps you, but hopefully it does the trick.

@Pnlvfx
Copy link
Author

Pnlvfx commented Sep 20, 2024

I've just merged that pr. Since it was provided by someone else it didn't come with tests, so I can't be entirely sure it does what helps you, but hopefully it does the trick.

I'l try it now and let you know if it does.

@Pnlvfx
Copy link
Author

Pnlvfx commented Sep 20, 2024

I've just merged that pr. Since it was provided by someone else it didn't come with tests, so I can't be entirely sure it does what helps you, but hopefully it does the trick.

Yes, it does fix the issue.

Copy link

github-actions bot commented Oct 4, 2024

This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up.
Thank you for contributing <3

@github-actions github-actions bot added the stale no activity for 2 weeks label Oct 4, 2024
Copy link

github-actions bot commented Nov 3, 2024

Automatically closing this issue due to lack of activity

@github-actions github-actions bot closed this as completed Nov 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info not enough information in issue to debug stale no activity for 2 weeks
Projects
None yet
Development

No branches or pull requests

2 participants