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

Make ModuleResolutionKind.Node10 change backward-compatible #53139

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/compiler/types.ts
Expand Up @@ -6940,6 +6940,12 @@ export function diagnosticCategoryName(d: { category: DiagnosticCategory }, lowe

export enum ModuleResolutionKind {
Classic = 1,
/**
* @deprecated
* `NodeJs` was renamed to `Node10` to better reflect the version of Node that it targets.
* Use the new name or consider switching to a modern module resolution target.
*/
NodeJs = 2,
andrewbranch marked this conversation as resolved.
Show resolved Hide resolved
Node10 = 2,
// Starting with node12, node's module resolver has significant departures from traditional cjs resolution
// to better support ecmascript modules and their use within node - however more features are still being added.
Expand All @@ -6948,7 +6954,7 @@ export enum ModuleResolutionKind {
// In turn, we offer both a `NodeNext` moving resolution target, and a `Node16` version-anchored resolution target
Node16 = 3,
NodeNext = 99, // Not simply `Node16` so that compiled code linked against TS can use the `Next` value reliably (same as with `ModuleKind`)
Bundler = 100,
Bundler = 100,
}

export enum ModuleDetectionKind {
Expand Down
6 changes: 6 additions & 0 deletions tests/baselines/reference/api/tsserverlibrary.d.ts
Expand Up @@ -6991,6 +6991,12 @@ declare namespace ts {
}
enum ModuleResolutionKind {
Classic = 1,
/**
* @deprecated
* `NodeJs` was renamed to `Node10` to better reflect the version of Node that it targets.
* Use the new name or consider switching to a modern module resolution target.
*/
NodeJs = 2,
Node10 = 2,
Node16 = 3,
NodeNext = 99,
Expand Down
6 changes: 6 additions & 0 deletions tests/baselines/reference/api/typescript.d.ts
Expand Up @@ -3048,6 +3048,12 @@ declare namespace ts {
}
enum ModuleResolutionKind {
Classic = 1,
/**
* @deprecated
* `NodeJs` was renamed to `Node10` to better reflect the version of Node that it targets.
* Use the new name or consider switching to a modern module resolution target.
*/
NodeJs = 2,
Node10 = 2,
Node16 = 3,
NodeNext = 99,
Expand Down