From dfa7259c2d96bfc9a3ae92a1e084a80f04c70de0 Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Wed, 2 Jan 2019 20:03:45 -0500 Subject: [PATCH] strictNullChecks for macLinuxKeyboardMapper (#65426) * strictNullChecks for macLinuxKeyboardMapper * Fix strict null check for assertResolveUserBinding * Add comma --- src/tsconfig.strictNullChecks.json | 3 ++- .../services/keybinding/test/keyboardMapperTestUtils.ts | 4 ++-- .../services/keybinding/test/macLinuxKeyboardMapper.test.ts | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/tsconfig.strictNullChecks.json b/src/tsconfig.strictNullChecks.json index fb344a5a405..63248993b99 100644 --- a/src/tsconfig.strictNullChecks.json +++ b/src/tsconfig.strictNullChecks.json @@ -808,10 +808,11 @@ "./vs/workbench/services/title/common/titleService.ts", "./vs/workbench/services/workspace/common/workspaceEditing.ts", "./vs/workbench/test/common/editor/editorOptions.test.ts", + "./vs/workbench/services/keybinding/test/macLinuxKeyboardMapper.test.ts", "./vs/workbench/test/common/notifications.test.ts", "./vs/workbench/test/electron-browser/api/extHostTypes.test.ts", "./vs/workbench/test/electron-browser/api/mock.ts" - ], + ], "exclude": [ "./typings/require-monaco.d.ts" ] diff --git a/src/vs/workbench/services/keybinding/test/keyboardMapperTestUtils.ts b/src/vs/workbench/services/keybinding/test/keyboardMapperTestUtils.ts index 28193723b81..37241813bae 100644 --- a/src/vs/workbench/services/keybinding/test/keyboardMapperTestUtils.ts +++ b/src/vs/workbench/services/keybinding/test/keyboardMapperTestUtils.ts @@ -34,8 +34,8 @@ function toIResolvedKeybinding(kb: ResolvedKeybinding): IResolvedKeybinding { }; } -export function assertResolveKeybinding(mapper: IKeyboardMapper, keybinding: Keybinding, expected: IResolvedKeybinding[]): void { - let actual: IResolvedKeybinding[] = mapper.resolveKeybinding(keybinding).map(toIResolvedKeybinding); +export function assertResolveKeybinding(mapper: IKeyboardMapper, keybinding: Keybinding | null, expected: IResolvedKeybinding[]): void { + let actual: IResolvedKeybinding[] = mapper.resolveKeybinding(keybinding!).map(toIResolvedKeybinding); assert.deepEqual(actual, expected); } diff --git a/src/vs/workbench/services/keybinding/test/macLinuxKeyboardMapper.test.ts b/src/vs/workbench/services/keybinding/test/macLinuxKeyboardMapper.test.ts index 19b5cef5e04..544b8ae03ef 100644 --- a/src/vs/workbench/services/keybinding/test/macLinuxKeyboardMapper.test.ts +++ b/src/vs/workbench/services/keybinding/test/macLinuxKeyboardMapper.test.ts @@ -1224,7 +1224,7 @@ suite('keyboardMapper', () => { test('issue #24064: NumLock/NumPad keys stopped working in 1.11 on Linux', () => { let mapper = new MacLinuxKeyboardMapper(false, {}, OperatingSystem.Linux); - function assertNumpadKeyboardEvent(keyCode: KeyCode, code: string, label: string, electronAccelerator: string, userSettingsLabel: string, dispatch: string): void { + function assertNumpadKeyboardEvent(keyCode: KeyCode, code: string, label: string, electronAccelerator: string | null, userSettingsLabel: string, dispatch: string): void { assertResolveKeyboardEvent( mapper, {