open-cli-tools / concurrently

Run commands concurrently. Like `npm run watch-js & npm run watch-less` but better.
https://www.npmjs.com/package/concurrently
MIT License
7.01k stars 228 forks source link

TypeScript types are wrong when `module` is `node16` #494

Closed dstaley closed 1 month ago

dstaley commented 1 month ago

When using concurrently in a project with module set to node16 (or nodeNext) in tsconfig.json, the default export of concurrently is not correct:

import concurrently from 'concurrently'
concurrently(); // This expression is not callable. Type 'typeof import("node_modules/concurrently/dist/src/index")' has no call signatures.

I believe this is due to the fact that the types field points to dist/src/index.d.ts for both the require and import fields in exports, which is not going to work since the files are two different module systems. You can see more compatibility issues here.

I'm happy to send in a PR to fix this in a few days, but I just wanted to throw the issue out there for awareness.

gustavohenke commented 1 month ago

Hey! I believe this might've been fixed by #456, it's just that it hasn't been released yet. It's been a while since I played with the type definitions, so at least https://arethetypeswrong.github.io gives all ✅ with the output of npm pack.

dstaley commented 1 month ago

oh you're totally right! it looks like that PR should solve the issue. sorry for the noise!

gustavohenke commented 1 week ago

Hey! This is now fixed in v9.0.0. https://github.com/open-cli-tools/concurrently/releases/tag/v9.0.0