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

Doesn't work with newer TypeScript versions #34

Open
DRKV333 opened this issue Jul 2, 2023 · 4 comments · May be fixed by #38
Open

Doesn't work with newer TypeScript versions #34

DRKV333 opened this issue Jul 2, 2023 · 4 comments · May be fixed by #38
Labels
bug Something isn't working

Comments

@DRKV333
Copy link

DRKV333 commented Jul 2, 2023

  • Version: 2.1.2
  • TypeScript Version: 5.1.6

Description

cjstoesm doesn't seem to work with TypeScript 5. Since TypeScript is a peer dependency, I don't think there is a way to provide cjstoesm with the right version, if a newer TypeScript is installed in the parent project. This workaround: #33 (comment) only works if it is not installed.

Expected Behavior

cjstoesm should work with projects that are using TypeScript 5.

Actual Behavior

C:\work\test\node_modules\typescript\lib\typescript.js:111514
      Debug.fail(`Unhandled SyntaxKind: ${Debug.formatSyntaxKind(node.kind)}.`);
            ^

Error: Debug Failure. Unhandled SyntaxKind: Unknown.
    at pipelineEmitWithHintWorker (C:\work\test\node_modules\typescript\lib\typescript.js:111514:13)
    at pipelineEmitWithHint (C:\work\test\node_modules\typescript\lib\typescript.js:111058:9)
    at pipelineEmitWithComments (C:\work\test\node_modules\typescript\lib\typescript.js:114842:7)
    at pipelineEmit (C:\work\test\node_modules\typescript\lib\typescript.js:111007:7)
    at emitExpression (C:\work\test\node_modules\typescript\lib\typescript.js:110991:7)
    at emitExportAssignment (C:\work\test\node_modules\typescript\lib\typescript.js:113087:7)
    at pipelineEmitWithHintWorker (C:\work\test\node_modules\typescript\lib\typescript.js:111270:20)
    at pipelineEmitWithHint (C:\work\test\node_modules\typescript\lib\typescript.js:111058:9)
    at pipelineEmitWithComments (C:\work\test\node_modules\typescript\lib\typescript.js:114842:7)
    at pipelineEmit (C:\work\test\node_modules\typescript\lib\typescript.js:111007:7)
@DRKV333 DRKV333 added the bug Something isn't working label Jul 2, 2023
@atjn
Copy link

atjn commented Aug 12, 2023

I have the same issue. I was able to temporarily fix it by adding this in my package.json:

"overrides": {
     "cjstoesm": {
        "typescript": "3.9.10"
    }
}

@dschnare
Copy link

dschnare commented Sep 7, 2023

Thanks, we'll need to downgrade our Typescript dependency then I guess.

@dschnare
Copy link

dschnare commented Sep 7, 2023

Works with Typescript 4.9.5.

@inoyakaigor
Copy link

Still doesn't work
image

C:\Users\InoY\AppData\Local\npm-cache\_npx\a471d542563e35be\node_modules\typescript\lib\typescript.js:115406
      Debug.fail(`Unhandled SyntaxKind: ${Debug.formatSyntaxKind(node.kind)}.`);
            ^

Error: Debug Failure. Unhandled SyntaxKind: ImportClause.
    at pipelineEmitWithHintWorker (C:\Users\InoY\AppData\Local\npm-cache\_npx\a471d542563e35be\node_modules\typescript\lib\typescript.js:115406:13)
    at pipelineEmitWithHint (C:\Users\InoY\AppData\Local\npm-cache\_npx\a471d542563e35be\node_modules\typescript\lib\typescript.js:114948:9)
    at pipelineEmitWithComments (C:\Users\InoY\AppData\Local\npm-cache\_npx\a471d542563e35be\node_modules\typescript\lib\typescript.js:118762:7)
    at pipelineEmit (C:\Users\InoY\AppData\Local\npm-cache\_npx\a471d542563e35be\node_modules\typescript\lib\typescript.js:114897:7)
    at emitExpression (C:\Users\InoY\AppData\Local\npm-cache\_npx\a471d542563e35be\node_modules\typescript\lib\typescript.js:114881:7)
    at emitImportDeclaration (C:\Users\InoY\AppData\Local\npm-cache\_npx\a471d542563e35be\node_modules\typescript\lib\typescript.js:116943:7)
    at pipelineEmitWithHintWorker (C:\Users\InoY\AppData\Local\npm-cache\_npx\a471d542563e35be\node_modules\typescript\lib\typescript.js:115150:20)
    at pipelineEmitWithHint (C:\Users\InoY\AppData\Local\npm-cache\_npx\a471d542563e35be\node_modules\typescript\lib\typescript.js:114948:9)
    at pipelineEmitWithComments (C:\Users\InoY\AppData\Local\npm-cache\_npx\a471d542563e35be\node_modules\typescript\lib\typescript.js:118762:7)
    at pipelineEmit (C:\Users\InoY\AppData\Local\npm-cache\_npx\a471d542563e35be\node_modules\typescript\lib\typescript.js:114897:7)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
4 participants