-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Closed
Labels
debtCode quality issuesCode quality issuesengineeringVS Code - Build / issue tracking / etc.VS Code - Build / issue tracking / etc.
Milestone
Description
We have enabled strictNullChecks
, but the TS compiler doesn't catch the following:
class A {
prop: number;
constructor() {
// forgot to assign to prop, so it will be undefined...
}
}
Possible fixes:
class A {
prop: number;
constructor() {
this.prop = 5; // Assign the property in the ctor
}
}
class A {
prop!: number; // use exclamation mark to suppress the error
constructor() {
this._init();
}
private _init() {
this.prop = 5;
}
}
In order to get errors for such cases, we need to add "strictPropertyInitialization": true
to our tsconfig.json
.
@microsoft/vscode it would be nice if we could tackle some of these errors during debt week.
[edit 11.11]: There are 8 errors left:
-
vs/base/browser/ui/tree/asyncDataTree.ts
@joaomoreno -
src/vs/workbench/api/common/extHostTypes.ts
@jrieken -
src/vs/workbench/api/common/extHostWebview.ts
@mjbvz
joaomoreno, Tyriar, Sovgut, Swatinem and tjquillan
Metadata
Metadata
Assignees
Labels
debtCode quality issuesCode quality issuesengineeringVS Code - Build / issue tracking / etc.VS Code - Build / issue tracking / etc.