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

Rename module resolution option node to node10 (preserving backward-compatible alias) #51901

Merged

Conversation

andrewbranch
Copy link
Member

Part of #50152

This does not make it an error to specify --moduleResolution node, but does ensure that if we ever mention the option, we call it node10. I’m going to see if we can give another push away from node when editing tsconfig files in VS Code as well. (I had initially proposed removing node from the JSON schema, but ideally we would want to do that only if the user’s TypeScript version is 5.0+, at least until that’s widely adopted.) That’s probably the extent of the deprecation warnings/errors we’ll be able to give.

@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Dec 15, 2022
@andrewbranch
Copy link
Member Author

Likely after the holidays, I also want to discuss a process for transitioning various defaults away from node10.

classic: ModuleResolutionKind.Classic,
node16: ModuleResolutionKind.Node16,
nodenext: ModuleResolutionKind.NodeNext,
bundler: ModuleResolutionKind.Bundler,
})),
deprecatedKeys: new Set(["node"]),
Copy link
Member Author

@andrewbranch andrewbranch Dec 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now, this only filters the config parsing diagnostic that says what the valid options are (next changed lines in this file).

@andrewbranch
Copy link
Member Author

Somehow I failed to update a big batch of baselines with this kind of change

-     "Module resolution kind is not specified, using 'NodeJs'.",
+     "Module resolution kind is not specified, using 'Node10'.",

@@ -3391,7 +3391,7 @@
"category": "Error",
"code": 2791
},
"Cannot find module '{0}'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?": {
"Cannot find module '{0}'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option?": {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also meant to leave some commentary on this change. This message was written when there were only two module resolution options, and only one worked with non-relative specifiers. Now that there’s node16, nodenext, and bundler, it’s a bit harder to infer what someone on classic should be on instead. I picked nodenext, but we could revisit this message in the future if we need to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants