-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Report use before definitely defined errors #5207
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
Comments
I think @vladima's CFA work might catch this. |
What is CFA? Latest commit does not detect this error. |
Code Flow Analysis. Fancy term for code reach-ability checking.
The work is not on master. Here is one PR : #4788 ... there might be others 🌹 |
this is not CFA; CFA is detecting unreachable code, e.g. a statement after a return. what this issue is about is Definite Assignment Analysis. you want to know that a variable is definitely assigned to before the first use site.
the JS spec talks about runtime errors. these can not all be detected at design time easily. issue #2854 is not the right issue. i will update this issue title to reflect the request. |
@mhegazy will refresh his PR and implement this for |
@sheetalkamat please include this in your PR in: #4343 |
Just because clicking through several links to find this issue is becoming a massive pain. This is an issue for TypeScript to:
Hopefully that makes this more Google-friendly. |
There is a big chance of TypeScript generating invalid code with cyclic dependencies. See microsoft/TypeScript#5207
Hi, just to point out that as of |
Committed: Someone from the TypeScript team will fix this bug or implement this feature more about labels at: https://github.com/Microsoft/TypeScript/wiki/FAQ#what-do-the-labels-on-these-issues-mean |
Thanks @mhegazy, that explains my confusion. |
Should be fixed in latest. |
This compiled code will throw a ReferenceError exception by native javascript engine if Class syntax is implemented. It means that TS compiler generate the invalid code. Should be disallow the use of a class before definition like a Let and Const Declaration because Class Declaration does not specified as hoisting target by es6 spec.
http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-statements-and-declarations
http://www.ecma-international.org/ecma-262/6.0/#sec-variable-statement
http://www.2ality.com/2015/02/es6-classes-final.html
I think, this issue is different from #2854 because this issue is based on spec.
The text was updated successfully, but these errors were encountered: