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

package.json diagnostics in --module nodenext #46861

Open
andrewbranch opened this issue Nov 18, 2021 · 3 comments
Open

package.json diagnostics in --module nodenext #46861

andrewbranch opened this issue Nov 18, 2021 · 3 comments
Assignees
Labels
Domain: ES Modules The issue relates to import/export style module behavior In Discussion Not yet reached consensus Rescheduled This issue was previously scheduled to an earlier milestone Suggestion An idea for TypeScript

Comments

@andrewbranch
Copy link
Member

In #46334, it became clear that it’s very easy to mess up writing export maps that will work correctly with --module nodenext. We would like to explore issuing diagnostics in package.json files in two scenarios (only in node12 and nodenext):

  • A types condition is not the first condition in an export map
  • A default condition is not the last condition in an export map

VS Code currently doesn’t synchronize unsaved changes to package.json files to TS Server (same as tsconfig.json files), so sending errors to the editor can only be done after a manual save. After getting the diagnostics in tsc, we’ll have to evaluate whether the experience in the editor is acceptable, or if we need to start syncing live changes to TS Server.

@andrewbranch andrewbranch added Experience Enhancement Noncontroversial enhancements Suggestion An idea for TypeScript and removed Suggestion An idea for TypeScript Experience Enhancement Noncontroversial enhancements labels Nov 18, 2021
@DanielRosenwasser DanielRosenwasser added Domain: ES Modules The issue relates to import/export style module behavior In Discussion Not yet reached consensus Suggestion An idea for TypeScript labels Nov 18, 2021
@dummdidumm
Copy link

If you want types to be the first condition I suggest to update the 4.5 beta blog posts like https://devblogs.microsoft.com/typescript/announcing-typescript-4-5-beta/ which contain the, according to you, wrong order (types is last in the exports map example)

@andrewbranch
Copy link
Member Author

I think we fixed that for the RC/stable post, @DanielRosenwasser is it worth going back to that?

@DanielRosenwasser
Copy link
Member

Let's discuss this at an upcoming design meeting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: ES Modules The issue relates to import/export style module behavior In Discussion Not yet reached consensus Rescheduled This issue was previously scheduled to an earlier milestone Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

5 participants