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

fix: sync target and lib #277

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

zanminkian
Copy link
Contributor

@zanminkian zanminkian commented Oct 12, 2024

  1. See Question: Why lib and target are not the same in @tsconfig/nodexx #271 (comment), TS 5.5 now support es2023 target.
  2. Node18 and Node19 will not support some features of es2023. Therefore, Node18 and Node19's lib should be es2022.

Closes #217.

@grundb
Copy link

grundb commented Jan 7, 2025

Is there a particular reason why lib is set for these files? As I understand the TSConfig reference, the lib option defaults to target meaning it could be omitted when they match.

@zanminkian
Copy link
Contributor Author

If there is no lib in tsconfig.json, TypeScript will load all node_modules/@types/* packages as its' libraries. This will cause some unexpected side effects. So personally, I prefer specifying lib in tsconfig.json too.

@jakebailey
Copy link

The reason to specify lib is that the default is to load <target>.full.lib.d.ts which will pull in DOM.

The@types auto loading is controlled by the types option, which is different.

@jakebailey
Copy link

jakebailey commented Jan 7, 2025

Note that this PR will break people targeting older versions of node, since they would not have these later syntaxes. That's a main reason not to bump them.

I would personally not do this.

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

Successfully merging this pull request may close these issues.

Node.js v18 & v19 don't support some es2023 features
3 participants