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

TypeScript should error on static attribute called 'name' #4143

Closed
vivainio opened this issue Aug 4, 2015 · 1 comment
Closed

TypeScript should error on static attribute called 'name' #4143

vivainio opened this issue Aug 4, 2015 · 1 comment
Labels
Duplicate An existing issue was already created

Comments

@vivainio
Copy link

vivainio commented Aug 4, 2015

"name" property on a function has a special meaning in JavaScript

(https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name)

If you do

class MyC {
 static name = "foo";
 foo() { 
  console.log(MyC.name);
 }
}

f = new MyC();
f.foo();

You get code that behaves unxpectedly (prints "MyC" instead of "foo". With minifaction, it will print a minified function name (e.g. "i").

Desired behavior: TypeScript should raise error or warning when you try to create static attribute called "name".

@mhegazy
Copy link
Contributor

mhegazy commented Aug 4, 2015

looks like a dupe of #442

@mhegazy mhegazy closed this as completed Aug 4, 2015
@mhegazy mhegazy added the Duplicate An existing issue was already created label Aug 4, 2015
@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
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants