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 work on instance fields with string names #22486
In the code below, removing the quotes from the instance field name triggers the expected compile-time error. I thought that maybe quoted fields are not checked, but apparently strictNullChecks works on quoted fields, so i think strictPropertyInitialization should work too.
Ok, now I see it was intended. But I don't see why it was decided to do it this way. It's easy for this kind of bug to sneak into the code, as setting strictPropertyInitialization makes the developer feel he is safe, when in fact he isn't.
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
Activity
RyanCavanaugh commentedon Mar 13, 2018
Quoted identifiers are not subject to this constraint; see the comment in #20075
lodo1995 commentedon Mar 13, 2018
Ok, now I see it was intended. But I don't see why it was decided to do it this way. It's easy for this kind of bug to sneak into the code, as setting
strictPropertyInitializationmakes the developer feel he is safe, when in fact he isn't.typescript-bot commentedon Mar 28, 2018
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.