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

Give a more helpful error message when using 'Type.propertyName' as a qualified type. #17458

Closed
DanielRosenwasser opened this issue Jul 27, 2017 · 3 comments
Assignees
Labels
Bug A bug in TypeScript Domain: Error Messages The issue relates to error messaging Fixed A PR has been merged for this issue

Comments

@DanielRosenwasser
Copy link
Member

image

https://twitter.com/KrisJordan/status/890594965541269505

@osi-oswald
Copy link

What was the reason to disallow qualified names? It feels more natural to be able to use both ways to look up member types.

@RyanCavanaugh
Copy link
Member

This code has always been legal:

interface Person { name: string; }
namespace Person {
  export type name = number;
}
var x: Person.name;

We didn't want to make a breaking change to make it illegal, or change the meaning of this code

@osi-oswald
Copy link

I see, but I guess this kind of ambiguity is quite rare (at least nowadays)? Could the following be a valid workaround:

  • Allow qualified names for interfaces/classes
  • If there is an ambiguity, namespaces take precedence (to not break existing code)

@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Domain: Error Messages The issue relates to error messaging Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

3 participants