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

Tweak UMD / global semantics #8678

Merged
merged 2 commits into from
May 23, 2016
Merged

Conversation

RyanCavanaugh
Copy link
Member

The behavior for UMD declarations is now that you cannot use UMD symbols from external modules. This removes the confusing concept of "was this file referenced or not?".

I've also renamed GlobalModuleExportDeclaration to NamespaceExportDeclaration because it was confusing.

Fixes #8255

@@ -1923,6 +1923,10 @@
"category": "Error",
"code": 2685
},
"Identifier '{0}' must be imported from a module": {
Copy link
Member

@DanielRosenwasser DanielRosenwasser May 19, 2016

Choose a reason for hiding this comment

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

But that isn't specifically the solution. The problem is that you're using something intended to be used as a global. Importing an identifier by that name from a module might not work at all. Importing the module as that name would work.

A better message might be

The namespace '{0}' declared in '{1}' is not accessible within a module. Did you mean to import the file instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't have a good way right now to generate {1} in that message (since we'd basically have to reverse-engineer a module name that would successfully resolve from the containing file).

How about

Global identifier {0} cannot be used from a module. Did you mean to import this from its module?

Copy link
Member

Choose a reason for hiding this comment

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

What about getting the path relative to the project root?

@DanielRosenwasser
Copy link
Member

I've also renamed GlobalModuleExportDeclaration to NamespaceExportDeclaration because it was confusing.

Still confusing, but better. 😄

@RyanCavanaugh
Copy link
Member Author

Any other comments?

@mhegazy
Copy link
Contributor

mhegazy commented May 23, 2016

Fixes #7843

@mhegazy
Copy link
Contributor

mhegazy commented May 23, 2016

The message is a bit vague, and can be enhanced, other than that 👍

@RyanCavanaugh RyanCavanaugh merged commit 27292e4 into microsoft:master May 23, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
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.

4 participants