Skip to content

Commit 6cee079

Browse files
committed
Remove suppressImplicitAnyIndexErrors For. microsoft#76442
1 parent 5bcdd66 commit 6cee079

13 files changed

Lines changed: 50 additions & 32 deletions

File tree

src/vs/code/node/cli.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { spawn, ChildProcess } from 'child_process';
6+
import { spawn, ChildProcess, SpawnOptions } from 'child_process';
77
import { assign } from 'vs/base/common/objects';
88
import { buildHelpMessage, buildVersionMessage, addArg, createWaitMarkerFile } from 'vs/platform/environment/node/argv';
99
import { parseCLIProcessArgv } from 'vs/platform/environment/node/argvHelper';
@@ -19,6 +19,7 @@ import { resolveTerminalEncoding } from 'vs/base/node/encoding';
1919
import * as iconv from 'iconv-lite';
2020
import { isWindows } from 'vs/base/common/platform';
2121
import { ProfilingSession, Target } from 'v8-inspect-profiler';
22+
import { isString } from 'vs/base/common/types';
2223

2324
function shouldSpawnCliProcess(argv: ParsedArgs): boolean {
2425
return !!argv['install-source']
@@ -339,14 +340,15 @@ export async function main(argv: string[]): Promise<any> {
339340
});
340341
}
341342

342-
if (args['js-flags']) {
343-
const match = /max_old_space_size=(\d+)/g.exec(args['js-flags']);
343+
const jsFlags = args['js-flags'];
344+
if (isString(jsFlags)) {
345+
const match = /max_old_space_size=(\d+)/g.exec(jsFlags);
344346
if (match && !args['max-memory']) {
345347
addArg(argv, `--max-memory=${match[1]}`);
346348
}
347349
}
348350

349-
const options = {
351+
const options: SpawnOptions = {
350352
detached: true,
351353
env
352354
};

src/vs/code/node/cliProcessMain.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export class Main {
8585
} else if (argv['install-extension']) {
8686
const arg = argv['install-extension'];
8787
const args: string[] = typeof arg === 'string' ? [arg] : arg;
88-
await this.installExtensions(args, argv['force']);
88+
await this.installExtensions(args, !!argv['force']);
8989

9090
} else if (argv['uninstall-extension']) {
9191
const arg = argv['uninstall-extension'];

src/vs/editor/contrib/folding/foldingModel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class FoldingModel {
4747
if (!regions.length) {
4848
return;
4949
}
50-
let processed = {};
50+
let processed: { [key: string]: boolean | undefined } = {};
5151
this._decorationProvider.changeDecorations(accessor => {
5252
for (let region of regions) {
5353
let index = region.regionIndex;

src/vs/platform/environment/common/environment.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ export interface ParsedArgs {
7171
'disable-user-env-probe'?: boolean;
7272
'enable-remote-auto-shutdown'?: boolean;
7373
'disable-inspect'?: boolean;
74+
'force'?: boolean;
75+
'js-flags'?: boolean;
76+
'gitCredential'?: string;
7477
}
7578

7679
export const IEnvironmentService = createDecorator<IEnvironmentService>('environmentService');

src/vs/platform/environment/node/argv.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ import { writeFileSync } from 'vs/base/node/pfs';
1414
* This code is also used by standalone cli's. Avoid adding any other dependencies.
1515
*/
1616

17-
class HelpCategories {
18-
o = localize('optionsUpperCase', "Options");
19-
e = localize('extensionsManagement', "Extensions Management");
20-
t = localize('troubleshooting', "Troubleshooting");
21-
}
17+
const helpCategories = {
18+
o: localize('optionsUpperCase', "Options"),
19+
e: localize('extensionsManagement', "Extensions Management"),
20+
t: localize('troubleshooting', "Troubleshooting")
21+
};
2222

2323
export interface Option {
2424
id: string;
@@ -27,7 +27,7 @@ export interface Option {
2727
deprecates?: string; // old deprecated id
2828
args?: string | string[];
2929
description?: string;
30-
cat?: keyof HelpCategories;
30+
cat?: keyof typeof helpCategories;
3131
}
3232

3333
export const options: Option[] = [
@@ -94,6 +94,7 @@ export const options: Option[] = [
9494
{ id: 'trace-category-filter', type: 'string' },
9595
{ id: 'trace-options', type: 'string' },
9696
{ id: 'prof-code-loading', type: 'boolean' },
97+
{ id: 'js-flags', type: 'string' },
9798
{ id: '_', type: 'string' }
9899
];
99100

@@ -189,8 +190,6 @@ function wrapText(text: string, columns: number): string[] {
189190
export function buildHelpMessage(productName: string, executableName: string, version: string, isOptionSupported = (_: Option) => true, isPipeSupported = true): string {
190191
const columns = (process.stdout).isTTY && (process.stdout).columns || 80;
191192

192-
let categories = new HelpCategories();
193-
194193
let help = [`${productName} ${version}`];
195194
help.push('');
196195
help.push(`${localize('usage', "Usage")}: ${executableName} [${localize('options', "options")}][${localize('paths', 'paths')}...]`);
@@ -203,10 +202,12 @@ export function buildHelpMessage(productName: string, executableName: string, ve
203202
}
204203
help.push('');
205204
}
206-
for (const key in categories) {
205+
for (let helpCategoryKey in helpCategories) {
206+
const key = <keyof typeof helpCategories>helpCategoryKey;
207+
207208
let categoryOptions = options.filter(o => !!o.description && o.cat === key && isOptionSupported(o));
208209
if (categoryOptions.length) {
209-
help.push(categories[key as keyof HelpCategories]);
210+
help.push(helpCategories[key]);
210211
help.push(...formatOptions(categoryOptions, columns));
211212
help.push('');
212213
}

src/vs/platform/history/common/history.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ export interface IRecentFile {
3434
}
3535

3636
export function isRecentWorkspace(curr: IRecent): curr is IRecentWorkspace {
37-
return !!curr['workspace'];
37+
return curr.hasOwnProperty('workspace');
3838
}
3939

4040
export function isRecentFolder(curr: IRecent): curr is IRecentFolder {
41-
return !!curr['folderUri'];
41+
return curr.hasOwnProperty('folderUri');
4242
}
4343

4444
export function isRecentFile(curr: IRecent): curr is IRecentFile {
45-
return !!curr['fileUri'];
45+
return curr.hasOwnProperty('fileUri');
4646
}
4747

4848

src/vs/platform/history/common/historyStorage.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ interface ILegacySerializedRecentlyOpened {
2121
interface ISerializedWorkspace { id: string; configURIPath: string; }
2222
interface ILegacySerializedWorkspace { id: string; configPath: string; }
2323

24+
function isLegacySerializedWorkspace(curr: any): curr is ILegacySerializedWorkspace {
25+
return typeof curr === 'object' && typeof curr['id'] === 'string' && typeof curr['configPath'] === 'string';
26+
}
27+
28+
function isUriComponents(curr: any): curr is UriComponents {
29+
return curr && typeof curr['path'] === 'string' && typeof curr['scheme'] === 'string';
30+
}
31+
2432
export type RecentlyOpenedStorageData = object;
2533

2634
export function restoreRecentlyOpened(data: RecentlyOpenedStorageData | undefined): IRecentlyOpened {
@@ -51,9 +59,9 @@ export function restoreRecentlyOpened(data: RecentlyOpenedStorageData | undefine
5159
for (const workspace of storedRecents.workspaces) {
5260
if (typeof workspace === 'string') {
5361
result.workspaces.push({ folderUri: URI.file(workspace) });
54-
} else if (typeof workspace === 'object' && typeof workspace['id'] === 'string' && typeof workspace['configPath'] === 'string') {
55-
result.workspaces.push({ workspace: { id: workspace['id'], configPath: URI.file(workspace['configPath']) } });
56-
} else if (workspace && typeof workspace['path'] === 'string' && typeof workspace['scheme'] === 'string') {
62+
} else if (isLegacySerializedWorkspace(workspace)) {
63+
result.workspaces.push({ workspace: { id: workspace.id, configPath: URI.file(workspace.configPath) } });
64+
} else if (isUriComponents(window)) {
5765
// added by 1.26-insiders
5866
result.workspaces.push({ folderUri: URI.revive(<UriComponents>workspace) });
5967
}

src/vs/workbench/contrib/themes/browser/themes.contribution.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ interface ThemeItem {
181181
}
182182

183183
function isItem(i: QuickPickInput<ThemeItem>): i is ThemeItem {
184-
return i['type'] !== 'separatpr';
184+
return (<any>i)['type'] !== 'separator';
185185
}
186186

187187
function toEntries(themes: Array<IColorTheme | IFileIconTheme>, label?: string): QuickPickInput<ThemeItem>[] {
@@ -212,7 +212,7 @@ class GenerateColorThemeAction extends Action {
212212
let theme = this.themeService.getColorTheme();
213213
let colors = Registry.as<IColorRegistry>(ColorRegistryExtensions.ColorContribution).getColors();
214214
let colorIds = colors.map(c => c.id).sort();
215-
let resultingColors = {};
215+
let resultingColors: { [key: string]: string } = {};
216216
let inherited: string[] = [];
217217
for (let colorId of colorIds) {
218218
const color = theme.getColor(colorId, false);

src/vs/workbench/services/themes/common/colorThemeData.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { startsWith } from 'vs/base/common/strings';
2323

2424
let colorRegistry = Registry.as<IColorRegistry>(Extensions.ColorContribution);
2525

26-
const tokenGroupToScopesMap: { [setting: string]: string[] } = {
26+
const tokenGroupToScopesMap = {
2727
comments: ['comment'],
2828
strings: ['string'],
2929
keywords: ['keyword - keyword.operator', 'keyword.control', 'storage', 'storage.type'],
@@ -146,10 +146,11 @@ export class ColorThemeData implements IColorTheme {
146146
// Put the general customizations such as comments, strings, etc. first so that
147147
// they can be overridden by specific customizations like "string.interpolated"
148148
for (let tokenGroup in tokenGroupToScopesMap) {
149-
let value = customTokenColors[tokenGroup];
149+
const group = <keyof typeof tokenGroupToScopesMap>tokenGroup; // TS doesn't type 'tokenGroup' properly
150+
let value = customTokenColors[group];
150151
if (value) {
151152
let settings = typeof value === 'string' ? { foreground: value } : value;
152-
let scopes = tokenGroupToScopesMap[tokenGroup];
153+
let scopes = tokenGroupToScopesMap[group];
153154
for (let scope of scopes) {
154155
this.customTokenColors.push({ scope, settings });
155156
}
@@ -186,7 +187,7 @@ export class ColorThemeData implements IColorTheme {
186187
}
187188

188189
toStorageData() {
189-
let colorMapData = {};
190+
let colorMapData: { [key: string]: string } = {};
190191
for (let key in this.colorMap) {
191192
colorMapData[key] = Color.Format.CSS.formatHexA(this.colorMap[key], true);
192193
}

src/vs/workbench/services/themes/common/fileIconThemeData.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,5 +366,5 @@ function _processIconThemeDocument(id: string, iconThemeDocumentLocation: URI, i
366366
return result;
367367
}
368368
function escapeCSS(str: string) {
369-
return window['CSS'].escape(str);
369+
return (<any>window)['CSS'].escape(str);
370370
}

0 commit comments

Comments
 (0)