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

Fix 'The operand of a 'delete' operator must be optional' errors in VS Code codebase #96022

Closed
13 tasks done
mjbvz opened this issue Apr 24, 2020 · 5 comments
Closed
13 tasks done
Assignees
Labels
debt Code quality issues
Milestone

Comments

@mjbvz
Copy link
Collaborator

mjbvz commented Apr 24, 2020

The latest TS 3.9 nightly catches a potential strict null check violation where you delete a property that is not marked optional:

interface Foo {
   x: number;
}

const a: Foo = { x: 3 };

delete a.x // new error here since `x` is not marked as being potentially undefined 

This revealed a few potential errors in our code:

  • vs/workbench/contrib/tasks/browser/taskQuickPick.ts(56,11) @alexr00
  • vs/workbench/contrib/tasks/browser/taskQuickPick.ts(57,11) @alexr00
  • vs/workbench/contrib/tasks/common/taskConfiguration.ts(1204,13) @alexr00
  • vs/workbench/contrib/search/test/browser/queryBuilder.test.ts(954,10) @roblourens
  • vs/workbench/contrib/search/test/browser/queryBuilder.test.ts(955,10) @roblourens
  • vs/workbench/contrib/search/common/searchModel.ts(1103,10) @roblourens
  • vs/workbench/contrib/debug/browser/debugToolBar.ts(274,11) @isidorn
  • vs/workbench/browser/parts/statusbar/statusbarPart.ts(706,12) @bpasero
  • vs/platform/environment/node/argv.ts(253,9) @aeschli
  • vs/workbench/api/node/extHostDebugService.ts(100,12) @weinand
  • vs/code/electron-main/window.ts(762,11) @bpasero
  • vs/code/electron-main/app.ts(196,12) @mjbvz
  • vs/server/remoteCli.ts(128,9) @aeschli

I've made some initial assignments but please reassign if you are not the correct owner

@mjbvz mjbvz added this to the April 2020 milestone Apr 24, 2020
@mjbvz mjbvz self-assigned this Apr 24, 2020
@mjbvz mjbvz added the debt Code quality issues label Apr 24, 2020
@mjbvz
Copy link
Collaborator Author

mjbvz commented Apr 24, 2020

I've marked this as April since it blocks us from picking up the latest TS build and providing feedback on it

/cc @DanielRosenwasser for awareness of the impact of this change

@mjbvz
Copy link
Collaborator Author

mjbvz commented Apr 24, 2020

Actually looks like TS may be reverting this change for TS 3.9. We should still fix these issues but don't need to do it this iteration

@alexr00
Copy link
Member

alexr00 commented Apr 24, 2020

@mjbvz How can force the error so I can make sure it's fixed?

@mjbvz
Copy link
Collaborator Author

mjbvz commented Apr 24, 2020

In the root of the VS Code project:

  • yarn add typescript@3.9.0-dev.20200423
  • Then restart the watch task and you should start seeing the errors

alexr00 added a commit that referenced this issue Apr 24, 2020
roblourens added a commit that referenced this issue Apr 24, 2020
aeschli added a commit that referenced this issue Apr 24, 2020
@mjbvz mjbvz added this to the May 2020 milestone Apr 27, 2020
@mjbvz
Copy link
Collaborator Author

mjbvz commented May 29, 2020

Closing this since most bugs have been fixed. I believe that TS 4.0 should add this check back

@mjbvz mjbvz closed this as completed May 29, 2020
@weinand weinand removed their assignment Jun 16, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Jul 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debt Code quality issues
Projects
None yet
Development

No branches or pull requests

7 participants