You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
StrictPropertyInitialization does not understand calls to helpers #21132
I understand that inheritance could make tracking calls from the constructor tricky if public methods were called.
Has there been any thought regarding just tracking private method calls for variable initialization? We've done something similar to reset internal state of classes for unit testing. In this way we could do the following.
exportclassTest{private_foo: string;constructor(){this._init();//<- follow this chainthis.myMethod();//<- don't follow this chain}private_init(override?: string){this._foo=override||'test';}publicmyMethod(){this._foo='bar';// This isn't used to track strict property init}publicresetState(){this._init('reset');}}
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
Activity
mhegazy commentedon Jan 10, 2018
The compiler does not analyze all calls from the constructor. for these, use definite assignment operator
!. see #20166RyanCavanaugh commentedon Jan 10, 2018
See also long discussion of how this would be an expected effect #8476
berickson1 commentedon Jan 11, 2018
I understand that inheritance could make tracking calls from the constructor tricky if public methods were called.
Has there been any thought regarding just tracking private method calls for variable initialization? We've done something similar to reset internal state of classes for unit testing. In this way we could do the following.
typescript-bot commentedon Jan 25, 2018
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.