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

CLI usage is throwing an error with node 22 #1943

Closed
ramaghanta opened this issue May 1, 2024 · 3 comments · Fixed by #1944
Closed

CLI usage is throwing an error with node 22 #1943

ramaghanta opened this issue May 1, 2024 · 3 comments · Fixed by #1944
Labels
released This issue/pull request has been released.

Comments

@ramaghanta
Copy link
Contributor

The following CLI command is throwing an error when run in node 22.

> ts-json-schema-generator --tsconfig tsconfig.json --no-top-ref --path record.ts --type Record --out record.schema.json

node_modules/ts-json-schema-generator/dist/ts-json-schema-generator.js:6
import pkg from "./package.json" assert { type: "json" };
                                 ^^^^^^

SyntaxError: Unexpected identifier 'assert'
    at compileSourceTextModule (node:internal/modules/esm/utils:337:16)
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:166:18)
    at callTranslator (node:internal/modules/esm/loader:416:14)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:422:30)
    at async link (node:internal/modules/esm/module_job:88:21)

Node.js v22.0.0

node 22 dropped support for import assertions (nodejs/node#52104) and it should be updated to use with

@domoritz
Copy link
Member

domoritz commented May 2, 2024

Can you send a pull request?

@ramaghanta
Copy link
Contributor Author

@domoritz, #1944

Copy link

🚀 Issue was released in v2.2.0 🚀

@github-actions github-actions bot added released This issue/pull request has been released. and removed prerelease labels May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants