Skip to content

Commit 3c2ed74

Browse files
committed
Strict null check menusExtensionPoint
1 parent aa33c3d commit 3c2ed74

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

src/tsconfig.strictNullChecks.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@
418418
"./vs/platform/dialogs/node/dialogIpc.ts",
419419
"./vs/platform/dialogs/node/dialogService.ts",
420420
"./vs/platform/download/common/download.ts",
421+
"./vs/platform/download/node/downloadIpc.ts",
421422
"./vs/platform/download/node/downloadService.ts",
422423
"./vs/platform/driver/electron-main/driver.ts",
423424
"./vs/platform/driver/node/driver.ts",
@@ -644,6 +645,7 @@
644645
"./vs/workbench/parts/welcome/gettingStarted/electron-browser/gettingStarted.ts",
645646
"./vs/workbench/parts/welcome/page/electron-browser/vs_code_welcome_page.ts",
646647
"./vs/workbench/parts/welcome/walkThrough/node/walkThroughUtils.ts",
648+
"./vs/workbench/services/actions/electron-browser/menusExtensionPoint.ts",
647649
"./vs/workbench/services/activity/common/activity.ts",
648650
"./vs/workbench/services/backup/common/backup.ts",
649651
"./vs/workbench/services/backup/node/backupFileService.ts",
@@ -716,8 +718,7 @@
716718
"./vs/workbench/services/themes/common/workbenchThemeService.ts",
717719
"./vs/workbench/services/title/common/titleService.ts",
718720
"./vs/workbench/services/workspace/common/workspaceEditing.ts",
719-
"./vs/workbench/test/electron-browser/api/mock.ts",
720-
"./vs/platform/download/node/downloadIpc.ts"
721+
"./vs/workbench/test/electron-browser/api/mock.ts"
721722
],
722723
"exclude": [
723724
"./typings/require-monaco.d.ts"

src/vs/workbench/services/actions/electron-browser/menusExtensionPoint.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { IJSONSchema } from 'vs/base/common/jsonSchema';
1010
import { forEach } from 'vs/base/common/collections';
1111
import { IExtensionPointUser, ExtensionMessageCollector, ExtensionsRegistry } from 'vs/workbench/services/extensions/common/extensionsRegistry';
1212
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
13-
import { MenuId, MenuRegistry, ILocalizedString } from 'vs/platform/actions/common/actions';
13+
import { MenuId, MenuRegistry, ILocalizedString, IMenuItem } from 'vs/platform/actions/common/actions';
1414
import { URI } from 'vs/base/common/uri';
1515

1616
namespace schema {
@@ -199,7 +199,7 @@ namespace schema {
199199
return true;
200200
}
201201

202-
function isValidIcon(icon: IUserFriendlyIcon, collector: ExtensionMessageCollector): boolean {
202+
function isValidIcon(icon: IUserFriendlyIcon | undefined, collector: ExtensionMessageCollector): boolean {
203203
if (typeof icon === 'undefined') {
204204
return true;
205205
}
@@ -286,7 +286,7 @@ ExtensionsRegistry.registerExtensionPoint<schema.IUserFriendlyCommand | schema.I
286286

287287
const { icon, category, title, command } = userFriendlyCommand;
288288

289-
let absoluteIcon: { dark: URI; light?: URI; };
289+
let absoluteIcon: { dark: URI; light?: URI; } | undefined;
290290
if (icon) {
291291
if (typeof icon === 'string') {
292292
absoluteIcon = { dark: resources.joinPath(extension.description.extensionLocation, icon) };
@@ -346,8 +346,8 @@ ExtensionsRegistry.registerExtensionPoint<{ [loc: string]: schema.IUserFriendlyM
346346
collector.info(localize('dupe.command', "Menu item references the same command as default and alt-command"));
347347
}
348348

349-
let group: string;
350-
let order: number;
349+
let group: string | undefined;
350+
let order: number | undefined;
351351
if (item.group) {
352352
const idx = item.group.lastIndexOf('@');
353353
if (idx > 0) {
@@ -364,7 +364,7 @@ ExtensionsRegistry.registerExtensionPoint<{ [loc: string]: schema.IUserFriendlyM
364364
group,
365365
order,
366366
when: ContextKeyExpr.deserialize(item.when)
367-
});
367+
} as IMenuItem);
368368
}
369369
});
370370
}

0 commit comments

Comments
 (0)