debt - remove lib.array-ext.d.ts and support Array.includes (fix #102566) (#105404)

This commit is contained in:
Benjamin Pasero 2020-08-26 13:07:30 +02:00 committed by GitHub
parent 0681925277
commit f922e8b757
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 9 additions and 20 deletions

View file

@ -16,6 +16,7 @@
},
"lib": [
"ES2015",
"ES2016.Array.Include",
"ES2017.String",
"ES2018.Promise",
"DOM",

View file

@ -15,7 +15,6 @@
"include": [
"typings/require.d.ts",
"typings/thenable.d.ts",
"typings/lib.array-ext.d.ts",
"vs/css.d.ts",
"vs/monaco.d.ts",
"vs/nls.d.ts",

View file

@ -1,11 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
interface ArrayConstructor {
isArray<T>(arg: ReadonlyArray<T> | null | undefined): arg is ReadonlyArray<T>;
isArray<T>(arg: Array<T> | null | undefined): arg is Array<T>;
isArray(arg: any): arg is Array<any>;
isArray<T>(arg: any): arg is Array<T>;
}

View file

@ -110,11 +110,11 @@ function fillInActions(groups: ReadonlyArray<[string, ReadonlyArray<MenuItemActi
}
if (isPrimaryGroup(group)) {
const to = Array.isArray<IAction>(target) ? target : target.primary;
const to = Array.isArray(target) ? target : target.primary;
to.unshift(...actions);
} else {
const to = Array.isArray<IAction>(target) ? target : target.secondary;
const to = Array.isArray(target) ? target : target.secondary;
if (to.length > 0) {
to.push(new Separator());

View file

@ -1120,7 +1120,7 @@ class ColorProviderAdapter {
provideColors(resource: URI, token: CancellationToken): Promise<extHostProtocol.IRawColorInfo[]> {
const doc = this._documents.getDocument(resource);
return asPromise(() => this._provider.provideDocumentColors(doc, token)).then(colors => {
if (!Array.isArray<vscode.ColorInformation>(colors)) {
if (!Array.isArray(colors)) {
return [];
}

View file

@ -535,11 +535,11 @@ function fillInActions(groups: [string, Array<MenuItemAction | SubmenuItemAction
}
if (isPrimaryGroup(group)) {
const to = Array.isArray<IAction>(target) ? target : target.primary;
const to = Array.isArray(target) ? target : target.primary;
to.unshift(...actions);
} else {
const to = Array.isArray<IAction>(target) ? target : target.secondary;
const to = Array.isArray(target) ? target : target.secondary;
if (to.length > 0) {
to.push(new Separator());

View file

@ -296,7 +296,7 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
private getCachedRecommendations(): IStringDictionary<number> {
let storedRecommendations = JSON.parse(this.storageService.get(recommendationsStorageKey, StorageScope.GLOBAL, '[]'));
if (Array.isArray<string>(storedRecommendations)) {
if (Array.isArray(storedRecommendations)) {
storedRecommendations = storedRecommendations.reduce((result, id) => { result[id] = Date.now(); return result; }, <IStringDictionary<number>>{});
}
const result: IStringDictionary<number> = {};

View file

@ -45,7 +45,7 @@ function fillInActions(groups: ReadonlyArray<[string, ReadonlyArray<MenuItemActi
const isPrimary = isPrimaryGroup(group);
if (isPrimary) {
const to = Array.isArray<IAction>(target) ? target : target.primary;
const to = Array.isArray(target) ? target : target.primary;
if (to.length > 0) {
to.push(new VerticalSeparator());
@ -55,7 +55,7 @@ function fillInActions(groups: ReadonlyArray<[string, ReadonlyArray<MenuItemActi
}
if (!isPrimary || alwaysFillSecondary) {
const to = Array.isArray<IAction>(target) ? target : target.secondary;
const to = Array.isArray(target) ? target : target.secondary;
if (to.length > 0) {
to.push(new Separator());