-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Reflect changes from https://devblogs.microsoft.com/typescript/announcing-typescript-5-9/ #3427
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
base: v2
Are you sure you want to change the base?
Conversation
@@ -868,7 +868,7 @@ tsc app.ts util.ts --target esnext --outfile index.js | |||
<td><code><a href='/tsconfig/#moduleResolution'>--moduleResolution</a></code></td> | |||
<td><p><code>classic</code>, <code>node10</code>/<code>node</code>, <code>node16</code>, <code>nodenext</code>, or <code>bundler</code></p> | |||
</td> | |||
<td><p><code>Node10</code> if <a href="#module"><code>module</code></a> is <code>CommonJS</code>; <code>Node16</code> if <a href="#module"><code>module</code></a> is <code>Node16</code> or <code>Node18</code>; <code>NodeNext</code> if <a href="#module"><code>module</code></a> is <code>NodeNext</code>; <code>Bundler</code> if <a href="#module"><code>module</code></a> is <code>Preserve</code>; <code>Classic</code> otherwise.</p> | |||
<td><p><code>Node10</code> if <a href="#module"><code>module</code></a> is <code>CommonJS</code>; <code>Node16</code> if <a href="#module"><code>module</code></a> is <code>Node16</code> or <code>Node18</code>; <code>Node20</code> if <a href="#module"><code>module</code></a> is <code>Node20</code>; <code>NodeNext</code> if <a href="#module"><code>module</code></a> is <code>NodeNext</code>; <code>Bundler</code> if <a href="#module"><code>module</code></a> is <code>Preserve</code>; <code>Classic</code> otherwise.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all is generated code; we need to update this separately.
@@ -240,6 +240,7 @@ export const defaultsForOptions = { | |||
moduleResolution: [ | |||
"`Node10` if [`module`](#module) is `CommonJS`;", | |||
"`Node16` if [`module`](#module) is `Node16` or `Node18`;", | |||
"`Node20` if [`module`](#module) is `Node20`;", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moduleResolution node20 doesn't exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah ok, so --module node20
implies what now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
node16, I believe; the resolution didn't change
@@ -105,7 +105,7 @@ The `module` compiler option provides this information to the compiler. Its prim | |||
|
|||
The available `module` settings are | |||
|
|||
- [**`node16`**](/docs/handbook/modules/reference.html#node16-node18-nodenext): Reflects the module system of Node.js v16+, which supports ES modules and CJS modules side-by-side with particular interoperability and detection rules. | |||
- [**`node16`**](/docs/handbook/modules/reference.html#node16-node18-node20-nodenext): Reflects the module system of Node.js v16+, which supports ES modules and CJS modules side-by-side with particular interoperability and detection rules. | |||
- [**`node18`**](/docs/handbook/modules/reference.html#node16-node18-nodenext): Reflects the module system of Node.js v18+, which adds support for import attributes. | |||
- [**`nodenext`**](/docs/handbook/modules/reference.html#node16-node18-nodenext): A moving target reflecting the latest Node.js versions as Node.js’s module system evolves. As of TypeScript 5.8, `nodenext` supports `require` of ECMAScript modules. | |||
- [**`es2015`**](/docs/handbook/modules/reference.html#es2015-es2020-es2022-esnext): Reflects the ES2015 language specification for JavaScript modules (the version that first introduced `import` and `export` to the language). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah need to update all these as well and maybe add a new block for node 20
|
||
- `node16` is available from TypeScript 4.7 | ||
- `node18` is available from TypeScript 5.8 as a replacement for `node16`, with added support for import attributes. | ||
- `nodenext` is available from TypeScript 4.7, but its behavior changes with the latest stable versions of Node.js. As of TypeScript 5.8, `nodenext` supports `require` of ECMAScript modules. | ||
- `node20` is available from TypeScript 5.9 and provides a stable option intended to model the behavior of Node.js v20. Unlike `nodenext`, this option is unlikely to have new behaviors in the future. Also unlike `nodenext`, specifying `--module node20` will imply `--target es2023` unless otherwise configured. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Realistically this should just say that it includes support for require(ESM), I think?
- `node20` is available from TypeScript 5.9 and provides a stable option intended to model the behavior of Node.js v20. Unlike `nodenext`, this option is unlikely to have new behaviors in the future. Also unlike `nodenext`, specifying `--module node20` will imply `--target es2023` unless otherwise configured. | ||
- `nodenext` is available from TypeScript 4.7, but its behavior changes with the latest stable versions of Node.js. As of TypeScript 5.8, `nodenext` supports `require` of ECMAScript modules. `--module nodenext` implies the floating `--target esnext`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- `node20` is available from TypeScript 5.9 and provides a stable option intended to model the behavior of Node.js v20. Unlike `nodenext`, this option is unlikely to have new behaviors in the future. Also unlike `nodenext`, specifying `--module node20` will imply `--target es2023` unless otherwise configured. | |
- `nodenext` is available from TypeScript 4.7, but its behavior changes with the latest stable versions of Node.js. As of TypeScript 5.8, `nodenext` supports `require` of ECMAScript modules. `--module nodenext` implies the floating `--target esnext`. | |
- `node20` adds support for require(ESM) from CommonJS modules. | |
- `nodenext` is available from TypeScript 4.7, but its behavior changes with the latest stable versions of Node.js. `--module nodenext` implies the floating `--target esnext`. |
@jakebailey Agree, should I keep it terse here to just decrease the odds of this being out of date again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'd keep it terse unless @andrewbranch has a better wording here.
https://devblogs.microsoft.com/typescript/announcing-typescript-5-9/
Adds a bunch of stuff about how
--module node20
implies target! This is really cool as I've complained before that--module
should configure more sensible defaults.I had some issues running some of the commands in the readme so will followup once I get those sorted out