Skip to content

fix(47076):Fix error term of declaration in modules #47087

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

Merged
merged 7 commits into from
Feb 9, 2022

Conversation

islandryu
Copy link
Contributor

Fixes #47076

I fix error term of declaration in modules.

  • "An import declaration can only be used in a namespace or module." →

    • When the node is in JS file, "An import declaration can only be used at the top level of a module."
    • Otherwise, "An import declaration can only be used at the top level of a namespace or module."
  • "An export declaration can only be used in a module." →

    • "An export declaration can only be used at the top level of a module."
  • "A namespace declaration is only allowed in a namespace or module." →

    • "A namespace declaration is only allowed at the top level of a module."

@ghost
Copy link

ghost commented Dec 9, 2021

CLA assistant check
All CLA requirements met.

@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Dec 9, 2021
@islandryu islandryu changed the title Fix error term of declaration in modules fix(47076):Fix error term of declaration in modules Dec 21, 2021
@DanielRosenwasser
Copy link
Member

Why isn't it

A namespace declaration is only allowed at the top level of a namespace or module.

?

@islandryu
Copy link
Contributor Author

@DanielRosenwasser
Indeed, it should be that way.
Fixed.

@sandersn sandersn merged commit 95c22d1 into microsoft:main Feb 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Backlog Bug PRs that fix a backlog bug
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Improve non-top-level import/export error, especially for JS
4 participants