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

Gate usage of --module/--moduleResolution node12/nodenext on nightly releases #46454

Closed
DanielRosenwasser opened this issue Oct 20, 2021 · 1 comment · Fixed by #46557
Closed
Assignees
Labels
Committed The team has roadmapped this issue Fix Available A PR has been opened for this issue Suggestion An idea for TypeScript

Comments

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Oct 20, 2021

In #46452 and #46453, we came to the conclusion that the nodenext and node12 settings for module and moduleResolution should not ship in TypeScript 4.5, and should instead be gated on nightly releases.

In a beta/rc/insiders/stable (or really, any non-dev) release

  • tsc should error on this flag combination
  • API users should get a diagnostic in program construction

One possible error message would be:

The '{0}' compiler option can only be set to '{1}' on nightly TypeScript releases. Learn more at: https://www.typescriptlang.org/docs/handbook/nightly-builds.html

another might be

The '{0}' compiler option can only be set to '{1}' on nightly TypeScript releases. Try updating with 'npm install -D typescript@next'.

One thing that's still a little fuzzy - I think .mts/.mjs/.cts/.cjs should be passively allowed in editing; but should they be errors to include within a compilation? Is it possible to make that distinction today?

@DanielRosenwasser DanielRosenwasser added Suggestion An idea for TypeScript Committed The team has roadmapped this issue labels Oct 20, 2021
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 4.5.1 milestone Oct 20, 2021
@weswigham
Copy link
Member

I think .mts/.mjs/.cts/.cjs should be passively allowed in editing; but should they be errors to include within a compilation?

I don't think that's a category of error we make right now - that'd be, like, what, an anti-suggestion? (Since suggestions are editor only). It's probably possible, but unlike the nightly-only option, I don't think we have much in place to actually make that possible yet, so it'd need a bit of work. But anyways, I don't see much of an issue allowing them in the old module modes, compilation or no, since we treat them the same as other input files in them (except for retaining extension associations, ofc). Maybe we'd add a suggestion in them to set the newer module mode, if/where/once available? I don't think we'd break anything about how they're handled in old modes, anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Committed The team has roadmapped this issue Fix Available A PR has been opened for this issue Suggestion An idea for TypeScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants