diff --git a/src/vs/base/common/winjs.base.d.ts b/src/vs/base/common/winjs.base.d.ts index 451ba709156..efac30a26b0 100644 --- a/src/vs/base/common/winjs.base.d.ts +++ b/src/vs/base/common/winjs.base.d.ts @@ -23,8 +23,6 @@ export class Promise { public static join(promises: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; public static join(promises: (T | PromiseLike)[]): Promise; - public static any(promises: (T | PromiseLike)[]): Promise<{ key: string; value: Promise; }>; - public static wrap(value: T | PromiseLike): Promise; public static wrapError(error: Error): Promise; diff --git a/src/vs/base/common/winjs.polyfill.promise.ts b/src/vs/base/common/winjs.polyfill.promise.ts index fb80ee9569b..3b24d0dbf8e 100644 --- a/src/vs/base/common/winjs.polyfill.promise.ts +++ b/src/vs/base/common/winjs.polyfill.promise.ts @@ -11,6 +11,10 @@ function isWinJSPromise(candidate: any): candidate is WinJSPromise { return isThenable(candidate) && typeof (candidate as any).done === 'function'; } +declare class WinJSPromiseRemovals { + any(promises: (T | PromiseLike)[]): WinJSPromise<{ key: string; value: WinJSPromise; }>; +} + /** * A polyfill for the native promises. The implementation is based on * WinJS promises but tries to gap differences between winjs promises @@ -33,7 +37,7 @@ export class PolyfillPromise implements Promise { static race(thenables: Thenable[]): PolyfillPromise { // WinJSPromise returns `{ key: , value: }` // from the `any` call and Promise.race just wants the value - return new PolyfillPromise(WinJSPromise.any(thenables).then(entry => entry.value, err => err.value)); + return new PolyfillPromise((WinJSPromise as any as WinJSPromiseRemovals).any(thenables).then(entry => entry.value, err => err.value)); } static resolve(value): PolyfillPromise { diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index d2f85c3b0e4..9615d0c4310 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -55,8 +55,6 @@ declare namespace monaco { public static join(promises: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; public static join(promises: (T | PromiseLike)[]): Promise; - public static any(promises: (T | PromiseLike)[]): Promise<{ key: string; value: Promise; }>; - public static wrap(value: T | PromiseLike): Promise; public static wrapError(error: Error): Promise; diff --git a/src/vs/platform/launch/electron-main/launchService.ts b/src/vs/platform/launch/electron-main/launchService.ts index f6a21723e29..954a8e5b50f 100644 --- a/src/vs/platform/launch/electron-main/launchService.ts +++ b/src/vs/platform/launch/electron-main/launchService.ts @@ -234,7 +234,7 @@ export class LaunchService implements ILaunchService { // is being used and only then resolve the startup promise which will kill this second instance. // In addition, we poll for the wait marker file to be deleted to return. if (args.wait && usedWindows.length === 1 && usedWindows[0]) { - return TPromise.any([ + return Promise.race([ this.windowsMainService.waitForWindowCloseOrLoad(usedWindows[0].id), whenDeleted(args.waitMarkerFilePath) ]).then(() => void 0, () => void 0); diff --git a/src/vs/workbench/api/node/extHostQuickOpen.ts b/src/vs/workbench/api/node/extHostQuickOpen.ts index 441e436e02e..4bdac9d6c64 100644 --- a/src/vs/workbench/api/node/extHostQuickOpen.ts +++ b/src/vs/workbench/api/node/extHostQuickOpen.ts @@ -54,8 +54,8 @@ export class ExtHostQuickOpen implements ExtHostQuickOpenShape { canPickMany: options && options.canPickMany }, token); - return TPromise.any([]>[quickPickWidget, itemsPromise]).then(values => { - if (values.key === '0') { + return Promise.race([]>[quickPickWidget.then(() => false), itemsPromise]).then(value => { + if (value === false) { return undefined; }