Update to use node 12 typings (#85578)

* Update to use node 12 typings

Fixes #82514

* Revert es6 promise changes

This gets us back to having the duplicate indentifier errors

* exclude es6-promise from vscode compile
This commit is contained in:
Matt Bierner 2019-12-17 13:40:04 -08:00 committed by GitHub
parent 043da28dda
commit ee0960b25b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 19 additions and 13 deletions

View file

@ -70,7 +70,7 @@
"@types/iconv-lite": "0.0.1", "@types/iconv-lite": "0.0.1",
"@types/keytar": "^4.4.0", "@types/keytar": "^4.4.0",
"@types/mocha": "2.2.39", "@types/mocha": "2.2.39",
"@types/node": "^10.12.12", "@types/node": "^12.11.7",
"@types/sinon": "^1.16.36", "@types/sinon": "^1.16.36",
"@types/webpack": "^4.4.10", "@types/webpack": "^4.4.10",
"@types/windows-foreground-love": "^0.3.0", "@types/windows-foreground-love": "^0.3.0",

View file

@ -24,6 +24,7 @@
"./vs" "./vs"
], ],
"exclude": [ "exclude": [
"./typings/es6-promise.d.ts",
"./typings/require-monaco.d.ts", "./typings/require-monaco.d.ts",
"./typings/xterm.d.ts", "./typings/xterm.d.ts",
"./typings/xterm-addon-search.d.ts", "./typings/xterm-addon-search.d.ts",

View file

@ -25,7 +25,7 @@ interface Map<K, V> {
interface MapConstructor { interface MapConstructor {
new <K, V>(): Map<K, V>; new <K, V>(): Map<K, V>;
prototype: Map<any, any>; readonly prototype: Map<any, any>;
// not supported on IE11: // not supported on IE11:
// new <K, V>(iterable: Iterable<[K, V]>): Map<K, V>; // new <K, V>(iterable: Iterable<[K, V]>): Map<K, V>;
@ -51,7 +51,7 @@ interface Set<T> {
interface SetConstructor { interface SetConstructor {
new <T>(): Set<T>; new <T>(): Set<T>;
prototype: Set<any>; readonly prototype: Set<any>;
// not supported on IE11: // not supported on IE11:
// new <T>(iterable: Iterable<T>): Set<T>; // new <T>(iterable: Iterable<T>): Set<T>;

View file

@ -34,7 +34,7 @@ export function createCancelablePromise<T>(callback: (token: CancellationToken)
}); });
}); });
return new class implements CancelablePromise<T> { return <CancelablePromise<T>>new class {
cancel() { cancel() {
source.cancel(); source.cancel();
} }

View file

@ -15,7 +15,7 @@ import { CharCode } from 'vs/base/common/charCode';
* - forEach() over the result to get the lines * - forEach() over the result to get the lines
*/ */
export class LineDecoder { export class LineDecoder {
private stringDecoder: sd.NodeStringDecoder; private stringDecoder: sd.StringDecoder;
private remaining: string | null; private remaining: string | null;
constructor(encoding: string = 'utf8') { constructor(encoding: string = 'utf8') {

View file

@ -27,6 +27,10 @@ export class LazyPromise implements Promise<any> {
this._err = null; this._err = null;
} }
get [Symbol.toStringTag](): string {
return this.toString();
}
private _ensureActual(): Promise<any> { private _ensureActual(): Promise<any> {
if (!this._actual) { if (!this._actual) {
this._actual = new Promise<any>((c, e) => { this._actual = new Promise<any>((c, e) => {

View file

@ -7,7 +7,7 @@ import * as childProcess from 'child_process';
import * as fs from 'fs'; import * as fs from 'fs';
import * as path from 'vs/base/common/path'; import * as path from 'vs/base/common/path';
import { Readable } from 'stream'; import { Readable } from 'stream';
import { NodeStringDecoder, StringDecoder } from 'string_decoder'; import { StringDecoder } from 'string_decoder';
import * as arrays from 'vs/base/common/arrays'; import * as arrays from 'vs/base/common/arrays';
import { toErrorMessage } from 'vs/base/common/errorMessage'; import { toErrorMessage } from 'vs/base/common/errorMessage';
import * as glob from 'vs/base/common/glob'; import * as glob from 'vs/base/common/glob';
@ -360,7 +360,7 @@ export class FileWalker {
}); });
} }
private forwardData(stream: Readable, encoding: string, cb: (err: Error | null, stdout?: string) => void): NodeStringDecoder { private forwardData(stream: Readable, encoding: string, cb: (err: Error | null, stdout?: string) => void): StringDecoder {
const decoder = new StringDecoder(encoding); const decoder = new StringDecoder(encoding);
stream.on('data', (data: Buffer) => { stream.on('data', (data: Buffer) => {
cb(null, decoder.write(data)); cb(null, decoder.write(data));

View file

@ -380,6 +380,7 @@ export class SearchService implements IRawSearchService {
*/ */
private preventCancellation<C>(promise: CancelablePromise<C>): CancelablePromise<C> { private preventCancellation<C>(promise: CancelablePromise<C>): CancelablePromise<C> {
return new class implements CancelablePromise<C> { return new class implements CancelablePromise<C> {
get [Symbol.toStringTag]() { return this.toString(); }
cancel() { cancel() {
// Do nothing // Do nothing
} }

View file

@ -6,7 +6,7 @@
import * as cp from 'child_process'; import * as cp from 'child_process';
import { EventEmitter } from 'events'; import { EventEmitter } from 'events';
import * as path from 'vs/base/common/path'; import * as path from 'vs/base/common/path';
import { NodeStringDecoder, StringDecoder } from 'string_decoder'; import { StringDecoder } from 'string_decoder';
import { createRegExp, startsWith, startsWithUTF8BOM, stripUTF8BOM, escapeRegExpCharacters, endsWith } from 'vs/base/common/strings'; import { createRegExp, startsWith, startsWithUTF8BOM, stripUTF8BOM, escapeRegExpCharacters, endsWith } from 'vs/base/common/strings';
import { URI } from 'vs/base/common/uri'; import { URI } from 'vs/base/common/uri';
import { IExtendedExtensionSearchOptions, SearchError, SearchErrorCode, serializeSearchError } from 'vs/workbench/services/search/common/search'; import { IExtendedExtensionSearchOptions, SearchError, SearchErrorCode, serializeSearchError } from 'vs/workbench/services/search/common/search';
@ -169,7 +169,7 @@ export class RipgrepParser extends EventEmitter {
private remainder = ''; private remainder = '';
private isDone = false; private isDone = false;
private hitLimit = false; private hitLimit = false;
private stringDecoder: NodeStringDecoder; private stringDecoder: StringDecoder;
private numResults = 0; private numResults = 0;

View file

@ -167,10 +167,10 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.21.tgz#7e8a0c34cf29f4e17a36e9bd0ea72d45ba03908e" resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.21.tgz#7e8a0c34cf29f4e17a36e9bd0ea72d45ba03908e"
integrity sha512-CBgLNk4o3XMnqMc0rhb6lc77IwShMEglz05deDcn2lQxyXEZivfwgYJu7SMha9V5XcrP6qZuevTHV/QrN2vjKQ== integrity sha512-CBgLNk4o3XMnqMc0rhb6lc77IwShMEglz05deDcn2lQxyXEZivfwgYJu7SMha9V5XcrP6qZuevTHV/QrN2vjKQ==
"@types/node@^10.12.12": "@types/node@^12.11.7":
version "10.12.12" version "12.12.14"
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.12.tgz#e15a9d034d9210f00320ef718a50c4a799417c47" resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.14.tgz#1c1d6e3c75dba466e0326948d56e8bd72a1903d2"
integrity sha512-Pr+6JRiKkfsFvmU/LK68oBRCQeEg36TyAbPhc2xpez24OOZZCuoIhWGTd39VZy6nGafSbxzGouFPTFD/rR1A0A== integrity sha512-u/SJDyXwuihpwjXy7hOOghagLEV1KdAST6syfnOk6QZAMzZuWZqXy5aYYZbh8Jdpd4escVFP0MvftHNDb9pruA==
"@types/node@^10.12.18": "@types/node@^10.12.18":
version "10.17.9" version "10.17.9"