Skip to content

Give better error message for using import as type#24979

Closed
rwaskiewicz wants to merge 1 commit into
microsoft:masterfrom
rwaskiewicz:give_better_error_message_for_using_import_as_type
Closed

Give better error message for using import as type#24979
rwaskiewicz wants to merge 1 commit into
microsoft:masterfrom
rwaskiewicz:give_better_error_message_for_using_import_as_type

Conversation

@rwaskiewicz
Copy link
Copy Markdown

@rwaskiewicz rwaskiewicz commented Jun 15, 2018

Fixes #24839

Changes:

  • Updates message for using import() as type to Did you mean "typeof import('@my_import')"? in DiagnosticMessages
  • Updated usages of message
  • Separate commit - found a missing semicolon while figuring out what I was doing wrong from a build perspective (or, VS Code found it - woo!). Kept as a separate commit to be left out/included at reviewers discretion Looks like this was fixed between opening this PR and now

This is the first PR I have for TS, so if there's anything I can improve on (in this PR or otherwise), please feel free to let me know 🙂

@rwaskiewicz rwaskiewicz force-pushed the give_better_error_message_for_using_import_as_type branch from 262580a to 129b168 Compare June 15, 2018 22:33
"code": 1339
},
"Module '{0}' does not refer to a type, but is used as a type here.": {
"Did you mean \"typeof import('{0}')\"?": {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We need this to be an elaboration and not a substitue. in other words, the original error message should still be there, and then add a trailing did you mean to use 'typeof import...'

Copy link
Copy Markdown
Contributor

@mhegazy mhegazy left a comment

Choose a reason for hiding this comment

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

You also need to update the test baselines, that is run the tests (jake runtests-parallel) then accept the baselines (jake baseline-accept).

@rwaskiewicz
Copy link
Copy Markdown
Author

Looks like this was fixed in #25433 - thanks for taking the time to review! 🙂

@rwaskiewicz rwaskiewicz deleted the give_better_error_message_for_using_import_as_type branch July 15, 2018 18:17
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Give a better error message for using import() as a type

2 participants