Skip to content

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

@mjbvz

Description

@mjbvz

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

Metadata

Metadata

Assignees

Labels

debtCode quality issues

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions