提交 61168fcf 编写于 作者: M Matt Bierner

Fixing / supressing more implict index errors

#76442
上级 6343b113
......@@ -170,9 +170,9 @@ export function getAllPropertyNames(obj: object): string[] {
}
export function getAllMethodNames(obj: object): string[] {
let methods: string[] = [];
const methods: string[] = [];
for (const prop of getAllPropertyNames(obj)) {
if (typeof obj[prop] === 'function') {
if (typeof (obj as any)[prop] === 'function') {
methods.push(prop);
}
}
......
......@@ -584,9 +584,10 @@ export class CodeWindow extends Disposable implements ICodeWindow {
// Config (combination of process.argv and window configuration)
const environment = parseArgs(process.argv);
const config = objects.assign(environment, windowConfiguration);
for (let key in config) {
if (config[key] === undefined || config[key] === null || config[key] === '' || config[key] === false) {
delete config[key]; // only send over properties that have a true value
for (const key in config) {
const configValue = (config as any)[key];
if (configValue === undefined || configValue === null || configValue === '' || configValue === false) {
delete (config as any)[key]; // only send over properties that have a true value
}
}
......
......@@ -290,14 +290,11 @@ export interface EncodedTokensProvider {
}
function isEncodedTokensProvider(provider: TokensProvider | EncodedTokensProvider): provider is EncodedTokensProvider {
return provider['tokenizeEncoded'];
return 'tokenizeEncoded' in provider;
}
function isThenable<T>(obj: any): obj is Thenable<T> {
if (typeof obj.then === 'function') {
return true;
}
return false;
return obj && typeof obj.then === 'function';
}
/**
......
......@@ -1018,7 +1018,7 @@ export class ChangeModeAction extends Action {
// If the association is already being made in the workspace, make sure to target workspace settings
let target = ConfigurationTarget.USER;
if (fileAssociationsConfig.workspace && !!fileAssociationsConfig.workspace[associationKey]) {
if (fileAssociationsConfig.workspace && !!(fileAssociationsConfig.workspace as any)[associationKey]) {
target = ConfigurationTarget.WORKSPACE;
}
......
......@@ -1117,11 +1117,12 @@ export class SettingsEditor2 extends BaseEditor {
const nlpResult = results[SearchResultIdx.Remote];
const nlpMetadata = nlpResult && nlpResult.metadata;
const durations = {};
durations['nlpResult'] = nlpMetadata && nlpMetadata.duration;
const durations = {
nlpResult: nlpMetadata && nlpMetadata.duration
};
// Count unique results
const counts = {};
const counts: { nlpResult?: number, filterResult?: number } = {};
const filterResult = results[SearchResultIdx.Local];
if (filterResult) {
counts['filterResult'] = filterResult.filterMatches.length;
......
......@@ -702,17 +702,16 @@ export class SettingExcludeRenderer extends AbstractSettingRenderer implements I
}
}
const sortKeys = (obj: Object) => {
const keyArray = Object.keys(obj)
.map(key => ({ key, val: obj[key] }))
.sort((a, b) => a.key.localeCompare(b.key));
const retVal = {};
keyArray.forEach(pair => {
retVal[pair.key] = pair.val;
});
function sortKeys<T extends object>(obj: T) {
const sortedKeys = Object.keys(obj)
.sort((a, b) => a.localeCompare(b)) as Array<keyof T>;
const retVal: Partial<T> = {};
for (const key of sortedKeys) {
retVal[key] = obj[key];
}
return retVal;
};
}
this._onDidChangeSetting.fire({
key: template.context.setting.key,
......
......@@ -19,6 +19,7 @@ import { ExtensionType } from 'vs/platform/extensions/common/extensions';
import { nullRange } from 'vs/workbench/services/preferences/common/preferencesModels';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { PreferencesSearchService as LocalPreferencesSearchService, SettingMatches } from 'vs/workbench/contrib/preferences/browser/preferencesSearch';
import { IStringDictionary } from 'vs/base/common/collections';
export interface IEndpointDetails {
urlBase?: string;
......@@ -252,7 +253,7 @@ class RemoteSearchProvider implements ISearchProvider {
}
const requestType = details.body ? 'post' : 'get';
const headers = {
const headers: IStringDictionary<string> = {
'User-Agent': 'request',
'Content-Type': 'application/json; charset=utf-8',
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册