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

Add nightly-only error on ImportType resolution mode assertion #49356

Conversation

andrewbranch
Copy link
Member

@andrewbranch andrewbranch commented Jun 2, 2022

Counterpart to #49002

The reverted commit shows errors that will appear in non-nightly (including the ones from #49002)

Fixes #49354

@andrewbranch
Copy link
Member Author

It should be noted that some of the errors added in this one are in .d.cts files that we generate when the input source did not use a resolution mode assertion.

@typescript-bot typescript-bot added For Milestone Bug PRs that fix a bug with a specific milestone and removed For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Jun 2, 2022
@andrewbranch andrewbranch marked this pull request as draft June 2, 2022 20:14
@andrewbranch
Copy link
Member Author

I think we need to add an emit resolver portability error (with a new error message) whenever the declaration emitter has to produce one of these

@andrewbranch
Copy link
Member Author

First draft:

The type of this expression cannot be named without a resolution mode assertion, which is an unstable feature. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Jun 2, 2022

The type of this expression cannot be named without a 'resolution-mode' assertion, which is an unstable feature. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.

My minor edits were just that it needs to be wrapped in single quotes, and I would encourage using a hyphen so people can understand what we're talking about better.

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Jun 2, 2022

Otherwise, I think that's good.

@andrewbranch andrewbranch force-pushed the bug/add-nightly-only-error-on-import-type-assertion branch from c163402 to e158d6c Compare June 2, 2022 20:54
@andrewbranch
Copy link
Member Author

@DanielRosenwasser I was matching this one:

image

Do you want me to update it too?

Comment on lines 38 to 40
export const b = import("package/mjs");
~
!!! error TS2841: The type of this expression cannot be named without a resolution mode assertion, which is an unstable feature. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
Copy link
Member Author

Choose a reason for hiding this comment

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

Here’s the new portability error in action. Bummer. 🥲

@andrewbranch
Copy link
Member Author

@DanielRosenwasser also this one?

image

@andrewbranch andrewbranch marked this pull request as ready for review June 2, 2022 21:25
@andrewbranch
Copy link
Member Author

@weswigham mind taking another look since I added some SymbolTracker code?

@andrewbranch
Copy link
Member Author

@typescript-bot cherry-pick this to release-4.7

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 2, 2022

Heya @andrewbranch, I've started to run the task to cherry-pick this into release-4.7 on this PR at da6f2a6. You can monitor the build here.

@andrewbranch andrewbranch merged commit 34fe835 into microsoft:main Jun 2, 2022
@typescript-bot
Copy link
Collaborator

Hey @andrewbranch, I couldn't open a PR with the cherry-pick. (You can check the log here). You may need to squash and pick this PR into release-4.7 manually.

andrewbranch added a commit to andrewbranch/TypeScript that referenced this pull request Jun 2, 2022
…soft#49356)

* Add nightly-only error on ImportType resolution mode assertion

* Temporarily change version to demonstrate errors

* Revert "Temporarily change version to demonstrate errors"

This reverts commit 40c2469.

* "Resolution mode" -> "resolution-mode"
@andrewbranch andrewbranch deleted the bug/add-nightly-only-error-on-import-type-assertion branch June 2, 2022 23:00
andrewbranch added a commit that referenced this pull request Jun 2, 2022
…assertion) into release-4.7 (#49365)

* Add nightly-only error on ImportType resolution mode assertion (#49356)

* Add nightly-only error on ImportType resolution mode assertion

* Temporarily change version to demonstrate errors

* Revert "Temporarily change version to demonstrate errors"

This reverts commit 40c2469.

* "Resolution mode" -> "resolution-mode"

* Update baselines
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Milestone Bug PRs that fix a bug with a specific milestone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No error on resolution-mode in import() types in stable versions
4 participants