Skip to content
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

Enable strictPropertyInitialization #78168

Closed
3 tasks
alexdima opened this issue Jul 30, 2019 · 19 comments
Closed
3 tasks

Enable strictPropertyInitialization #78168

alexdima opened this issue Jul 30, 2019 · 19 comments
Assignees
Labels
debt Code quality issues engineering VS Code - Build / issue tracking / etc.
Milestone

Comments

@alexdima
Copy link
Member

alexdima commented Jul 30, 2019

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
@alexdima alexdima added the debt Code quality issues label Jul 30, 2019
@jrieken jrieken added the engineering VS Code - Build / issue tracking / etc. label Jul 30, 2019
@alexdima alexdima self-assigned this Jul 30, 2019
@isidorn isidorn self-assigned this Jul 30, 2019
@isidorn
Copy link
Contributor

isidorn commented Jul 30, 2019

Adding it to next milestone so it shows up in my issue query for debt week.
If we do not tackle it completely we can always move it to the next one afterwards.

@isidorn isidorn added this to the August 2019 milestone Jul 30, 2019
@jrieken jrieken self-assigned this Jul 30, 2019
@sandy081 sandy081 self-assigned this Jul 30, 2019
@Tyriar Tyriar self-assigned this Jul 31, 2019
@joaomoreno joaomoreno self-assigned this Jul 31, 2019
@alexr00 alexr00 self-assigned this Jul 31, 2019
@roblourens roblourens self-assigned this Aug 1, 2019
jrieken added a commit that referenced this issue Aug 5, 2019
jrieken added a commit that referenced this issue Aug 5, 2019
@alexr00 alexr00 removed their assignment Aug 5, 2019
alexr00 added a commit that referenced this issue Aug 5, 2019
isidorn added a commit that referenced this issue Aug 5, 2019
@joaomoreno
Copy link
Member

Went through a bunch of these.

joaomoreno added a commit that referenced this issue Aug 5, 2019
@bpasero bpasero self-assigned this Aug 5, 2019
@joaomoreno joaomoreno removed their assignment Aug 5, 2019
isidorn added a commit that referenced this issue Aug 5, 2019
isidorn added a commit that referenced this issue Aug 5, 2019
isidorn added a commit that referenced this issue Aug 6, 2019
isidorn added a commit that referenced this issue Aug 6, 2019
@isidorn isidorn removed their assignment Aug 6, 2019
sbatten added a commit that referenced this issue Oct 16, 2019
@sbatten sbatten removed their assignment Oct 16, 2019
bpasero added a commit that referenced this issue Oct 17, 2019
@chrmarti chrmarti modified the milestones: October 2019, November 2019 Nov 1, 2019
@bpasero
Copy link
Member

bpasero commented Nov 1, 2019

Getting there:

image

@chrmarti if you do yours I can maybe look into Sandeeps.

@chrmarti chrmarti removed their assignment Nov 4, 2019
@chrmarti
Copy link
Contributor

chrmarti commented Nov 4, 2019

@bpasero Done. 👍

@bpasero
Copy link
Member

bpasero commented Nov 4, 2019

Looks like Sandy is back :)

@sandy081
Copy link
Member

Yes, I am back and on to this 😄

@sandy081 sandy081 assigned joaomoreno, jrieken and mjbvz and unassigned sandy081 Nov 11, 2019
@sandy081
Copy link
Member

sandy081 added a commit that referenced this issue Nov 11, 2019
sandy081 added a commit that referenced this issue Nov 11, 2019
@bpasero
Copy link
Member

bpasero commented Nov 11, 2019

Remaining:
image

@mjbvz d.ts & webview
@joaomoreno async tree
@jrieken extHostTypes (call hierarchy related it seems)

mjbvz added a commit that referenced this issue Nov 11, 2019
@mjbvz
Copy link
Collaborator

mjbvz commented Nov 11, 2019

Fixed extHostWebview again. Down to four errors in three files:

  • viewsViewlet.ts
  • `asyncDataTree.ts
  • extHostTypes.ts

@mjbvz mjbvz removed their assignment Nov 11, 2019
@sandy081
Copy link
Member

Ping @alexr00 for viewsViewlet.ts

@bpasero
Copy link
Member

bpasero commented Nov 12, 2019

I went ahead and resolved those so that we do not have to play the catch up game all the time 👍

@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debt Code quality issues engineering VS Code - Build / issue tracking / etc.
Projects
None yet
Development

No branches or pull requests