diff --git a/src/tsconfig.strictNullChecks.json b/src/tsconfig.strictNullChecks.json index abecf8c05d1..f2f69af3270 100644 --- a/src/tsconfig.strictNullChecks.json +++ b/src/tsconfig.strictNullChecks.json @@ -741,6 +741,7 @@ "./vs/workbench/services/themes/common/colorThemeSchema.ts", "./vs/workbench/services/themes/common/fileIconThemeSchema.ts", "./vs/workbench/services/themes/common/workbenchThemeService.ts", + "./vs/workbench/services/themes/electron-browser/fileIconThemeData.ts", "./vs/workbench/services/title/common/titleService.ts", "./vs/workbench/services/workspace/common/workspaceEditing.ts", "./vs/workbench/test/electron-browser/api/mock.ts" diff --git a/src/vs/workbench/services/themes/common/workbenchThemeService.ts b/src/vs/workbench/services/themes/common/workbenchThemeService.ts index 71d5dd447e1..5fa7344a2d4 100644 --- a/src/vs/workbench/services/themes/common/workbenchThemeService.ts +++ b/src/vs/workbench/services/themes/common/workbenchThemeService.ts @@ -41,9 +41,9 @@ export interface IColorMap { export interface IFileIconTheme extends IIconTheme { readonly id: string; readonly label: string; - readonly settingsId: string; + readonly settingsId?: string; readonly description?: string; - readonly extensionData: ExtensionData; + readonly extensionData?: ExtensionData; readonly isLoaded: boolean; readonly hasFileIcons: boolean; diff --git a/src/vs/workbench/services/themes/electron-browser/fileIconThemeData.ts b/src/vs/workbench/services/themes/electron-browser/fileIconThemeData.ts index 5b4136989fb..bc1449601f0 100644 --- a/src/vs/workbench/services/themes/electron-browser/fileIconThemeData.ts +++ b/src/vs/workbench/services/themes/electron-browser/fileIconThemeData.ts @@ -15,25 +15,24 @@ import { getParseErrorMessage } from 'vs/base/common/jsonErrorMessages'; export class FileIconThemeData implements IFileIconTheme { id: string; label: string; - settingsId: string; + settingsId?: string; description?: string; hasFileIcons: boolean; hasFolderIcons: boolean; hidesExplorerArrows: boolean; isLoaded: boolean; location?: URI; - extensionData: ExtensionData; + extensionData?: ExtensionData; styleSheetContent?: string; - private constructor() { - } + private constructor() { } public ensureLoaded(fileService: IFileService): Thenable { if (!this.isLoaded) { if (this.location) { return _loadIconThemeDocument(fileService, this.location).then(iconThemeDocument => { - let result = _processIconThemeDocument(this.id, this.location, iconThemeDocument); + let result = _processIconThemeDocument(this.id, this.location!, iconThemeDocument); this.styleSheetContent = result.content; this.hasFileIcons = result.hasFileIcons; this.hasFolderIcons = result.hasFolderIcons; @@ -66,17 +65,17 @@ export class FileIconThemeData implements IFileIconTheme { themeData = FileIconThemeData._noIconTheme = new FileIconThemeData(); themeData.id = ''; themeData.label = ''; - themeData.settingsId = null; + themeData.settingsId = undefined; themeData.hasFileIcons = false; themeData.hasFolderIcons = false; themeData.hidesExplorerArrows = false; themeData.isLoaded = true; - themeData.extensionData = null; + themeData.extensionData = undefined; } return themeData; } - static fromStorageData(input: string): FileIconThemeData { + static fromStorageData(input: string): FileIconThemeData | null { try { let data = JSON.parse(input); let theme = new FileIconThemeData(); @@ -169,7 +168,7 @@ function _loadIconThemeDocument(fileService: IFileService, location: URI): Thena function _processIconThemeDocument(id: string, iconThemeDocumentLocation: URI, iconThemeDocument: IconThemeDocument): { content: string; hasFileIcons: boolean; hasFolderIcons: boolean; hidesExplorerArrows: boolean; } { - let result = { content: '', hasFileIcons: false, hasFolderIcons: false, hidesExplorerArrows: iconThemeDocument.hidesExplorerArrows }; + const result = { content: '', hasFileIcons: false, hasFolderIcons: false, hidesExplorerArrows: !!iconThemeDocument.hidesExplorerArrows }; if (!iconThemeDocument.iconDefinitions) { return result; @@ -178,10 +177,10 @@ function _processIconThemeDocument(id: string, iconThemeDocumentLocation: URI, i const iconThemeDocumentLocationDirname = resources.dirname(iconThemeDocumentLocation); function resolvePath(path: string) { - return resources.joinPath(iconThemeDocumentLocationDirname, path); + return resources.joinPath(iconThemeDocumentLocationDirname!, path); } - function collectSelectors(associations: IconsAssociation, baseThemeClassName?: string) { + function collectSelectors(associations: IconsAssociation | undefined, baseThemeClassName?: string) { function addSelector(selector: string, defId: string) { if (defId) { let list = selectorByDefinitionId[defId];