microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
100.93k stars 12.47k forks source link

package.json diagnostics in `--module nodenext` #46861

Open andrewbranch opened 2 years ago

andrewbranch commented 2 years ago

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):

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.

dummdidumm commented 2 years ago

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 commented 2 years ago

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

DanielRosenwasser commented 2 years ago

Let's discuss this at an upcoming design meeting.