Remove suppressImplicitAnyIndexErrors For. #76442

This commit is contained in:
Martin Aeschlimann 2019-07-03 11:57:51 +02:00
parent 5bcdd6643b
commit 6cee0791bf
13 changed files with 50 additions and 32 deletions

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { spawn, ChildProcess } from 'child_process';
import { spawn, ChildProcess, SpawnOptions } from 'child_process';
import { assign } from 'vs/base/common/objects';
import { buildHelpMessage, buildVersionMessage, addArg, createWaitMarkerFile } from 'vs/platform/environment/node/argv';
import { parseCLIProcessArgv } from 'vs/platform/environment/node/argvHelper';
@ -19,6 +19,7 @@ import { resolveTerminalEncoding } from 'vs/base/node/encoding';
import * as iconv from 'iconv-lite';
import { isWindows } from 'vs/base/common/platform';
import { ProfilingSession, Target } from 'v8-inspect-profiler';
import { isString } from 'vs/base/common/types';
function shouldSpawnCliProcess(argv: ParsedArgs): boolean {
return !!argv['install-source']
@ -339,14 +340,15 @@ export async function main(argv: string[]): Promise<any> {
});
}
if (args['js-flags']) {
const match = /max_old_space_size=(\d+)/g.exec(args['js-flags']);
const jsFlags = args['js-flags'];
if (isString(jsFlags)) {
const match = /max_old_space_size=(\d+)/g.exec(jsFlags);
if (match && !args['max-memory']) {
addArg(argv, `--max-memory=${match[1]}`);
}
}
const options = {
const options: SpawnOptions = {
detached: true,
env
};

View file

@ -85,7 +85,7 @@ export class Main {
} else if (argv['install-extension']) {
const arg = argv['install-extension'];
const args: string[] = typeof arg === 'string' ? [arg] : arg;
await this.installExtensions(args, argv['force']);
await this.installExtensions(args, !!argv['force']);
} else if (argv['uninstall-extension']) {
const arg = argv['uninstall-extension'];

View file

@ -47,7 +47,7 @@ export class FoldingModel {
if (!regions.length) {
return;
}
let processed = {};
let processed: { [key: string]: boolean | undefined } = {};
this._decorationProvider.changeDecorations(accessor => {
for (let region of regions) {
let index = region.regionIndex;

View file

@ -71,6 +71,9 @@ export interface ParsedArgs {
'disable-user-env-probe'?: boolean;
'enable-remote-auto-shutdown'?: boolean;
'disable-inspect'?: boolean;
'force'?: boolean;
'js-flags'?: boolean;
'gitCredential'?: string;
}
export const IEnvironmentService = createDecorator<IEnvironmentService>('environmentService');

View file

@ -14,11 +14,11 @@ import { writeFileSync } from 'vs/base/node/pfs';
* This code is also used by standalone cli's. Avoid adding any other dependencies.
*/
class HelpCategories {
o = localize('optionsUpperCase', "Options");
e = localize('extensionsManagement', "Extensions Management");
t = localize('troubleshooting', "Troubleshooting");
}
const helpCategories = {
o: localize('optionsUpperCase', "Options"),
e: localize('extensionsManagement', "Extensions Management"),
t: localize('troubleshooting', "Troubleshooting")
};
export interface Option {
id: string;
@ -27,7 +27,7 @@ export interface Option {
deprecates?: string; // old deprecated id
args?: string | string[];
description?: string;
cat?: keyof HelpCategories;
cat?: keyof typeof helpCategories;
}
export const options: Option[] = [
@ -94,6 +94,7 @@ export const options: Option[] = [
{ id: 'trace-category-filter', type: 'string' },
{ id: 'trace-options', type: 'string' },
{ id: 'prof-code-loading', type: 'boolean' },
{ id: 'js-flags', type: 'string' },
{ id: '_', type: 'string' }
];
@ -189,8 +190,6 @@ function wrapText(text: string, columns: number): string[] {
export function buildHelpMessage(productName: string, executableName: string, version: string, isOptionSupported = (_: Option) => true, isPipeSupported = true): string {
const columns = (process.stdout).isTTY && (process.stdout).columns || 80;
let categories = new HelpCategories();
let help = [`${productName} ${version}`];
help.push('');
help.push(`${localize('usage', "Usage")}: ${executableName} [${localize('options', "options")}][${localize('paths', 'paths')}...]`);
@ -203,10 +202,12 @@ export function buildHelpMessage(productName: string, executableName: string, ve
}
help.push('');
}
for (const key in categories) {
for (let helpCategoryKey in helpCategories) {
const key = <keyof typeof helpCategories>helpCategoryKey;
let categoryOptions = options.filter(o => !!o.description && o.cat === key && isOptionSupported(o));
if (categoryOptions.length) {
help.push(categories[key as keyof HelpCategories]);
help.push(helpCategories[key]);
help.push(...formatOptions(categoryOptions, columns));
help.push('');
}

View file

@ -34,15 +34,15 @@ export interface IRecentFile {
}
export function isRecentWorkspace(curr: IRecent): curr is IRecentWorkspace {
return !!curr['workspace'];
return curr.hasOwnProperty('workspace');
}
export function isRecentFolder(curr: IRecent): curr is IRecentFolder {
return !!curr['folderUri'];
return curr.hasOwnProperty('folderUri');
}
export function isRecentFile(curr: IRecent): curr is IRecentFile {
return !!curr['fileUri'];
return curr.hasOwnProperty('fileUri');
}

View file

@ -21,6 +21,14 @@ interface ILegacySerializedRecentlyOpened {
interface ISerializedWorkspace { id: string; configURIPath: string; }
interface ILegacySerializedWorkspace { id: string; configPath: string; }
function isLegacySerializedWorkspace(curr: any): curr is ILegacySerializedWorkspace {
return typeof curr === 'object' && typeof curr['id'] === 'string' && typeof curr['configPath'] === 'string';
}
function isUriComponents(curr: any): curr is UriComponents {
return curr && typeof curr['path'] === 'string' && typeof curr['scheme'] === 'string';
}
export type RecentlyOpenedStorageData = object;
export function restoreRecentlyOpened(data: RecentlyOpenedStorageData | undefined): IRecentlyOpened {
@ -51,9 +59,9 @@ export function restoreRecentlyOpened(data: RecentlyOpenedStorageData | undefine
for (const workspace of storedRecents.workspaces) {
if (typeof workspace === 'string') {
result.workspaces.push({ folderUri: URI.file(workspace) });
} else if (typeof workspace === 'object' && typeof workspace['id'] === 'string' && typeof workspace['configPath'] === 'string') {
result.workspaces.push({ workspace: { id: workspace['id'], configPath: URI.file(workspace['configPath']) } });
} else if (workspace && typeof workspace['path'] === 'string' && typeof workspace['scheme'] === 'string') {
} else if (isLegacySerializedWorkspace(workspace)) {
result.workspaces.push({ workspace: { id: workspace.id, configPath: URI.file(workspace.configPath) } });
} else if (isUriComponents(window)) {
// added by 1.26-insiders
result.workspaces.push({ folderUri: URI.revive(<UriComponents>workspace) });
}

View file

@ -181,7 +181,7 @@ interface ThemeItem {
}
function isItem(i: QuickPickInput<ThemeItem>): i is ThemeItem {
return i['type'] !== 'separatpr';
return (<any>i)['type'] !== 'separator';
}
function toEntries(themes: Array<IColorTheme | IFileIconTheme>, label?: string): QuickPickInput<ThemeItem>[] {
@ -212,7 +212,7 @@ class GenerateColorThemeAction extends Action {
let theme = this.themeService.getColorTheme();
let colors = Registry.as<IColorRegistry>(ColorRegistryExtensions.ColorContribution).getColors();
let colorIds = colors.map(c => c.id).sort();
let resultingColors = {};
let resultingColors: { [key: string]: string } = {};
let inherited: string[] = [];
for (let colorId of colorIds) {
const color = theme.getColor(colorId, false);

View file

@ -23,7 +23,7 @@ import { startsWith } from 'vs/base/common/strings';
let colorRegistry = Registry.as<IColorRegistry>(Extensions.ColorContribution);
const tokenGroupToScopesMap: { [setting: string]: string[] } = {
const tokenGroupToScopesMap = {
comments: ['comment'],
strings: ['string'],
keywords: ['keyword - keyword.operator', 'keyword.control', 'storage', 'storage.type'],
@ -146,10 +146,11 @@ export class ColorThemeData implements IColorTheme {
// Put the general customizations such as comments, strings, etc. first so that
// they can be overridden by specific customizations like "string.interpolated"
for (let tokenGroup in tokenGroupToScopesMap) {
let value = customTokenColors[tokenGroup];
const group = <keyof typeof tokenGroupToScopesMap>tokenGroup; // TS doesn't type 'tokenGroup' properly
let value = customTokenColors[group];
if (value) {
let settings = typeof value === 'string' ? { foreground: value } : value;
let scopes = tokenGroupToScopesMap[tokenGroup];
let scopes = tokenGroupToScopesMap[group];
for (let scope of scopes) {
this.customTokenColors.push({ scope, settings });
}
@ -186,7 +187,7 @@ export class ColorThemeData implements IColorTheme {
}
toStorageData() {
let colorMapData = {};
let colorMapData: { [key: string]: string } = {};
for (let key in this.colorMap) {
colorMapData[key] = Color.Format.CSS.formatHexA(this.colorMap[key], true);
}

View file

@ -366,5 +366,5 @@ function _processIconThemeDocument(id: string, iconThemeDocumentLocation: URI, i
return result;
}
function escapeCSS(str: string) {
return window['CSS'].escape(str);
return (<any>window)['CSS'].escape(str);
}

View file

@ -143,7 +143,7 @@ function _parse(content: string, filename: string | null, locationKeyName: strin
if (curKey === null) {
return fail('missing <key>');
}
let newDict = {};
let newDict: { [key: string]: any } = {};
if (locationKeyName !== null) {
newDict[locationKeyName] = {
filename: filename,
@ -168,7 +168,7 @@ function _parse(content: string, filename: string | null, locationKeyName: strin
const arrState = {
enterDict: function () {
let newDict = {};
let newDict: { [key: string]: any } = {};
if (locationKeyName !== null) {
newDict[locationKeyName] = {
filename: filename,

View file

@ -26,7 +26,8 @@ export function convertSettings(oldSettings: ITokenColorizationRule[], resultRul
if (!settings) {
rule.settings = {};
} else {
for (let key in settings) {
for (const settingKey in settings) {
const key = <keyof typeof settings>settingKey;
let mappings = settingToColorIdMapping[key];
if (mappings) {
let colorHex = settings[key];

View file

@ -69,6 +69,7 @@ export interface IColorCustomizations {
}
export interface ITokenColorCustomizations {
[groupIdOrThemeSettingsId: string]: string | ITokenColorizationSetting | ITokenColorCustomizations | undefined | ITokenColorizationRule[];
comments?: string | ITokenColorizationSetting;
strings?: string | ITokenColorizationSetting;
numbers?: string | ITokenColorizationSetting;
@ -103,5 +104,6 @@ export interface IThemeExtensionPoint {
label?: string;
description?: string;
path: string;
uiTheme?: typeof VS_LIGHT_THEME | typeof VS_DARK_THEME | typeof VS_HC_THEME;
_watch: boolean; // unsupported options to watch location
}