Skip to content

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

Merged
Andrew Branch (andrewbranch) merged 4 commits into
microsoft:mainfrom
andrewbranch:bug/add-nightly-only-error-on-import-type-assertion
Jun 2, 2022
Merged

Andrew Branch (andrewbranch) merged 4 commits into
microsoft:mainfrom
andrewbranch:bug/add-nightly-only-error-on-import-type-assertion

Conversation

@andrewbranch

@andrewbranch Andrew Branch (andrewbranch) commented Jun 2, 2022 •

Copy link
Copy Markdown
Member

Counterpart to #49002

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

Fixes #49354

@andrewbranch

Copy link
Copy Markdown
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 (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
Andrew Branch (andrewbranch) marked this pull request as draft June 2, 2022 20:14
@andrewbranch

Copy link
Copy Markdown
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
Copy Markdown
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

Daniel Rosenwasser (DanielRosenwasser) commented Jun 2, 2022 •

Copy link
Copy Markdown
Member

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

Daniel Rosenwasser (DanielRosenwasser) commented Jun 2, 2022 •

Copy link
Copy Markdown
Member

Otherwise, I think that's good.

@andrewbranch
Andrew Branch (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
Copy Markdown
Member Author

Daniel Rosenwasser (@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
Copy Markdown
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
Copy Markdown
Member Author
@andrewbranch

Copy link
Copy Markdown
Member Author

Wesley Wigham (@weswigham) mind taking another look since I added some SymbolTracker code?

@andrewbranch

Copy link
Copy Markdown
Member Author

TypeScript Bot (@typescript-bot) cherry-pick this to release-4.7

@typescript-bot

TypeScript Bot (typescript-bot) commented Jun 2, 2022 •

Copy link
Copy Markdown
Contributor

Heya Andrew Branch (@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
Andrew Branch (andrewbranch) merged commit 34fe835 into microsoft:main Jun 2, 2022
@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Andrew Branch (@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.

Andrew Branch (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
Andrew Branch (andrewbranch) deleted the bug/add-nightly-only-error-on-import-type-assertion branch June 2, 2022 23:00
Andrew Branch (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
@microsoft Microsoft (microsoft) locked as resolved and limited conversation to collaborators Oct 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Author: Team For Milestone Bug PRs that fix a bug with a specific milestone

4 participants