-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
should warn/error on forward references during field initialization #12673
Comments
TypeScript Version: 2.1.4 Code function B() {
// comment-out the '**A' lines to see the 'used before its declaration' error
;(function() { // **A
++x;
})() // **A
let x = 0
} Expected behavior: Actual behavior: |
> (()=>{ (()=>x)(); let x; })()
ReferenceError: x is not defined
at repl:1:13
at repl:1:15
at repl:1:28
at sigintHandlersWrap (vm.js:22:35)
at sigintHandlersWrap (vm.js:96:12)
at ContextifyScript.Script.runInThisContext (vm.js:21:12)
at REPLServer.defaultEval (repl.js:313:29)
at bound (domain.js:280:14)
at REPLServer.runBound [as eval] (domain.js:293:12)
at REPLServer.<anonymous> (repl.js:513:10)
> (()=>{ let x; (()=>x)(); })()
undefined
> process.version
'v6.9.2'
> |
@SlurpTheo I think you're basically looking for #11498 |
@RyanCavanaugh I think that is very close to my concern -- yes/thanks! (My 2nd #12673 (comment) from earlier today shows how |
TypeScript Version: 2.0.10
I'd expect the forward field references to trigger an error (or at least a warning, maybe configurable) similar to function locals.
The text was updated successfully, but these errors were encountered: