Description
TypeScript Version:
2.7.0 and above.
Search Terms:
strictNullChecks strictPropertyInitialization
Code
class C {
foo: number;
bar = "hello";
baz: boolean;
constructor() {
this.foo = 42;
}
}
Expected behavior:
TS documentation should mention that --strictNullChecks
flag is needed for --strictPropertyInitialization
one to actually have an effect.
This would properly document the actual code change in this commit :
This was clearly mentionned in the corresponding PR description.
Also @mihailik suggested that a warning could also be emitted. Has this been done?
Actual behavior:
This is mentioned nowhere in the documentation.
Documentation for --strictPropertyInitialization
is Ensure non-undefined class properties are initialized in the constructor..
To determine if a class property is non-undefined, --strictNullChecks
flag must be turned on.
Related Issues:
I found no existing issue for updating the documentation about this.