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

Error TS2349 using concurrently in full ESM module #454

Closed
throrin19 opened this issue Dec 11, 2023 · 2 comments · Fixed by #456
Closed

Error TS2349 using concurrently in full ESM module #454

throrin19 opened this issue Dec 11, 2023 · 2 comments · Fixed by #456
Labels

Comments

@throrin19
Copy link

throrin19 commented Dec 11, 2023

Hello,

I have a problem using concurrently (and others modules) in my project after migrate from CJS to full ESM. I have the error TS2349 when I try to call concurrently function. But, In VSCode, the definition is correctly loaded on CTRL+click :/

This is my config :

  • tsconfig.json
    {
      "compileOnSave": false,
      "compilerOptions": {
        "rootDir": ".",
        "sourceMap": true,
        "declaration": true,
        "esModuleInterop": true,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "importHelpers": false,
        "resolveJsonModule": true,
        "noImplicitAny": false,
        "strict": true,
        "useDefineForClassFields": false,
        "target": "ES2022",
        "lib": [
          "esnext"
        ],
        "skipLibCheck": true,
        "skipDefaultLibCheck": true,
        "baseUrl": ".",
        "outDir": "dist",
        "types": [
          "node"
        ],
        "module": "NodeNext",
        "moduleResolution": "NodeNext",
      }
    }

And my example code :

import concurrently from 'concurrently';

const main = async () => {
    concurrently([
        { command : 'ls /etc' },
        { command : 'ls /usr' }
    ]);
}

main();

He is a screen on my VSCode :
image

I don't know how to do to fix that. I think my problem is with typescript, but I don't understand how to fix that :/

@throrin19 throrin19 changed the title Error TS2349 using concurenttly in full ESM module Error TS2349 using concurrently in full ESM module Dec 11, 2023
@gustavohenke
Copy link
Member

Hey! So apparently there's a lengthy discussion here about this issue: microsoft/TypeScript#50058
It's coming from the use of module: "Nodenext" in your tsconfig.json.

There are a couple of hacks suggested in there that you could try, but none that is pretty.
It seems that what typescript is doing is right for your compiler options. Concurrently is a commonjs module, hacked to look like a native ESM module.

@gustavohenke
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants