From fde1eda88119dc508e4856bdf04dd4c77ae02d3f Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 14 Feb 2017 11:54:46 -0800 Subject: [PATCH] Update LKG --- lib/lib.d.ts | 185 ++++++++++++++++++---------- lib/lib.dom.d.ts | 130 ++++++++++---------- lib/lib.es2015.promise.d.ts | 50 -------- lib/lib.es5.d.ts | 55 ++++++++- lib/lib.es6.d.ts | 235 ++++++++++++++++++------------------ lib/lib.webworker.d.ts | 70 +++++------ lib/tsc.js | 25 +++- lib/tsserver.js | 27 ++++- lib/tsserverlibrary.js | 27 ++++- lib/typescript.js | 40 ++++-- lib/typescriptServices.js | 40 ++++-- lib/typingsInstaller.js | 1 + 12 files changed, 518 insertions(+), 367 deletions(-) diff --git a/lib/lib.d.ts b/lib/lib.d.ts index 874c1681f85..c9254b57839 100644 --- a/lib/lib.d.ts +++ b/lib/lib.d.ts @@ -361,14 +361,14 @@ interface String { /** * Replaces text in a string, using a regular expression or search string. - * @param searchValue A string that represents the regular expression. + * @param searchValue A string to search for. * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. */ replace(searchValue: string, replaceValue: string): string; /** * Replaces text in a string, using a regular expression or search string. - * @param searchValue A string that represents the regular expression. + * @param searchValue A string to search for. * @param replacer A function that returns the replacement text. */ replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; @@ -1371,6 +1371,57 @@ interface PromiseLike { onrejected: (reason: any) => TResult2 | PromiseLike): PromiseLike; } +/** + * Represents the completion of an asynchronous operation + */ +interface Promise { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => T | PromiseLike) | undefined | null, onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): Promise; + + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled: ((value: T) => T | PromiseLike) | undefined | null, onrejected: (reason: any) => TResult | PromiseLike): Promise; + + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled: (value: T) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise; + + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled: (value: T) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; + + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): Promise; + + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected: (reason: any) => TResult | PromiseLike): Promise; +} + interface ArrayLike { readonly length: number; readonly [n: number]: T; @@ -5529,7 +5580,7 @@ interface AudioContextBase extends EventTarget { onstatechange: (this: AudioContext, ev: Event) => any; readonly sampleRate: number; readonly state: string; - close(): PromiseLike; + close(): Promise; createAnalyser(): AnalyserNode; createBiquadFilter(): BiquadFilterNode; createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer; @@ -5549,14 +5600,14 @@ interface AudioContextBase extends EventTarget { createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; createStereoPanner(): StereoPannerNode; createWaveShaper(): WaveShaperNode; - decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): PromiseLike; - resume(): PromiseLike; + decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): Promise; + resume(): Promise; addEventListener(type: K, listener: (this: AudioContext, ev: AudioContextEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } interface AudioContext extends AudioContextBase { - suspend(): PromiseLike; + suspend(): Promise; } declare var AudioContext: { @@ -6274,13 +6325,13 @@ declare var CSSSupportsRule: { } interface Cache { - add(request: RequestInfo): PromiseLike; - addAll(requests: RequestInfo[]): PromiseLike; - delete(request: RequestInfo, options?: CacheQueryOptions): PromiseLike; + add(request: RequestInfo): Promise; + addAll(requests: RequestInfo[]): Promise; + delete(request: RequestInfo, options?: CacheQueryOptions): Promise; keys(request?: RequestInfo, options?: CacheQueryOptions): any; - match(request: RequestInfo, options?: CacheQueryOptions): PromiseLike; + match(request: RequestInfo, options?: CacheQueryOptions): Promise; matchAll(request?: RequestInfo, options?: CacheQueryOptions): any; - put(request: RequestInfo, response: Response): PromiseLike; + put(request: RequestInfo, response: Response): Promise; } declare var Cache: { @@ -6289,11 +6340,11 @@ declare var Cache: { } interface CacheStorage { - delete(cacheName: string): PromiseLike; - has(cacheName: string): PromiseLike; + delete(cacheName: string): Promise; + has(cacheName: string): Promise; keys(): any; - match(request: RequestInfo, options?: CacheQueryOptions): PromiseLike; - open(cacheName: string): PromiseLike; + match(request: RequestInfo, options?: CacheQueryOptions): Promise; + open(cacheName: string): Promise; } declare var CacheStorage: { @@ -9914,7 +9965,7 @@ interface HTMLMediaElement extends HTMLElement { * Loads and starts playback of a media resource. */ play(): void; - setMediaKeys(mediaKeys: MediaKeys | null): PromiseLike; + setMediaKeys(mediaKeys: MediaKeys | null): Promise; readonly HAVE_CURRENT_DATA: number; readonly HAVE_ENOUGH_DATA: number; readonly HAVE_FUTURE_DATA: number; @@ -11492,7 +11543,7 @@ interface MSApp { execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; getCurrentPriority(): string; - getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike; + getHtmlPrintDocumentSourceAsync(htmlDoc: any): Promise; getViewId(view: any): any; isTaskScheduledAtPriorityOrHigher(priority: string): boolean; pageHandlesAllApplicationActivations(enabled: boolean): void; @@ -11553,8 +11604,8 @@ declare var MSBlobBuilder: { } interface MSCredentials { - getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): PromiseLike; - makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): PromiseLike; + getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): Promise; + makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): Promise; } declare var MSCredentials: { @@ -11942,7 +11993,7 @@ interface MediaDevices extends EventTarget { ondevicechange: (this: MediaDevices, ev: Event) => any; enumerateDevices(): any; getSupportedConstraints(): MediaTrackSupportedConstraints; - getUserMedia(constraints: MediaStreamConstraints): PromiseLike; + getUserMedia(constraints: MediaStreamConstraints): Promise; addEventListener(type: K, listener: (this: MediaDevices, ev: MediaDevicesEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12001,15 +12052,15 @@ declare var MediaKeyMessageEvent: { } interface MediaKeySession extends EventTarget { - readonly closed: PromiseLike; + readonly closed: Promise; readonly expiration: number; readonly keyStatuses: MediaKeyStatusMap; readonly sessionId: string; - close(): PromiseLike; - generateRequest(initDataType: string, initData: any): PromiseLike; - load(sessionId: string): PromiseLike; - remove(): PromiseLike; - update(response: any): PromiseLike; + close(): Promise; + generateRequest(initDataType: string, initData: any): Promise; + load(sessionId: string): Promise; + remove(): Promise; + update(response: any): Promise; } declare var MediaKeySession: { @@ -12031,7 +12082,7 @@ declare var MediaKeyStatusMap: { interface MediaKeySystemAccess { readonly keySystem: string; - createMediaKeys(): PromiseLike; + createMediaKeys(): Promise; getConfiguration(): MediaKeySystemConfiguration; } @@ -12042,7 +12093,7 @@ declare var MediaKeySystemAccess: { interface MediaKeys { createSession(sessionType?: string): MediaKeySession; - setServerCertificate(serverCertificate: any): PromiseLike; + setServerCertificate(serverCertificate: any): Promise; } declare var MediaKeys: { @@ -12181,7 +12232,7 @@ interface MediaStreamTrack extends EventTarget { readonly readonly: boolean; readonly readyState: string; readonly remote: boolean; - applyConstraints(constraints: MediaTrackConstraints): PromiseLike; + applyConstraints(constraints: MediaTrackConstraints): Promise; clone(): MediaStreamTrack; getCapabilities(): MediaTrackCapabilities; getConstraints(): MediaTrackConstraints; @@ -12415,7 +12466,7 @@ interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorConte getGamepads(): Gamepad[]; javaEnabled(): boolean; msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void; - requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike; + requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): Promise; vibrate(pattern: number | number[]): boolean; } @@ -12575,7 +12626,7 @@ interface Notification extends EventTarget { declare var Notification: { prototype: Notification; new(title: string, options?: NotificationOptions): Notification; - requestPermission(callback?: NotificationPermissionCallback): PromiseLike; + requestPermission(callback?: NotificationPermissionCallback): Promise; } interface OES_element_index_uint { @@ -12646,8 +12697,8 @@ interface OfflineAudioContextEventMap extends AudioContextEventMap { interface OfflineAudioContext extends AudioContextBase { readonly length: number; oncomplete: (this: OfflineAudioContext, ev: OfflineAudioCompletionEvent) => any; - startRendering(): PromiseLike; - suspend(suspendTime: number): PromiseLike; + startRendering(): Promise; + suspend(suspendTime: number): Promise; addEventListener(type: K, listener: (this: OfflineAudioContext, ev: OfflineAudioContextEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12762,8 +12813,8 @@ interface PaymentRequest extends EventTarget { readonly shippingAddress: PaymentAddress | null; readonly shippingOption: string | null; readonly shippingType: string | null; - abort(): PromiseLike; - show(): PromiseLike; + abort(): Promise; + show(): Promise; addEventListener(type: K, listener: (this: PaymentRequest, ev: PaymentRequestEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12774,7 +12825,7 @@ declare var PaymentRequest: { } interface PaymentRequestUpdateEvent extends Event { - updateWith(d: PromiseLike): void; + updateWith(d: Promise): void; } declare var PaymentRequestUpdateEvent: { @@ -12790,7 +12841,7 @@ interface PaymentResponse { readonly payerPhone: string | null; readonly shippingAddress: PaymentAddress | null; readonly shippingOption: string | null; - complete(result?: string): PromiseLike; + complete(result?: string): Promise; toJSON(): any; } @@ -13116,9 +13167,9 @@ declare var ProgressEvent: { } interface PushManager { - getSubscription(): PromiseLike; - permissionState(options?: PushSubscriptionOptionsInit): PromiseLike; - subscribe(options?: PushSubscriptionOptionsInit): PromiseLike; + getSubscription(): Promise; + permissionState(options?: PushSubscriptionOptionsInit): Promise; + subscribe(options?: PushSubscriptionOptionsInit): Promise; } declare var PushManager: { @@ -13131,7 +13182,7 @@ interface PushSubscription { readonly options: PushSubscriptionOptions; getKey(name: string): ArrayBuffer | null; toJSON(): any; - unsubscribe(): PromiseLike; + unsubscribe(): Promise; } declare var PushSubscription: { @@ -13325,19 +13376,19 @@ interface RTCPeerConnection extends EventTarget { onsignalingstatechange: (this: RTCPeerConnection, ev: Event) => any; readonly remoteDescription: RTCSessionDescription | null; readonly signalingState: string; - addIceCandidate(candidate: RTCIceCandidate, successCallback?: VoidFunction, failureCallback?: RTCPeerConnectionErrorCallback): PromiseLike; + addIceCandidate(candidate: RTCIceCandidate, successCallback?: VoidFunction, failureCallback?: RTCPeerConnectionErrorCallback): Promise; addStream(stream: MediaStream): void; close(): void; - createAnswer(successCallback?: RTCSessionDescriptionCallback, failureCallback?: RTCPeerConnectionErrorCallback): PromiseLike; - createOffer(successCallback?: RTCSessionDescriptionCallback, failureCallback?: RTCPeerConnectionErrorCallback, options?: RTCOfferOptions): PromiseLike; + createAnswer(successCallback?: RTCSessionDescriptionCallback, failureCallback?: RTCPeerConnectionErrorCallback): Promise; + createOffer(successCallback?: RTCSessionDescriptionCallback, failureCallback?: RTCPeerConnectionErrorCallback, options?: RTCOfferOptions): Promise; getConfiguration(): RTCConfiguration; getLocalStreams(): MediaStream[]; getRemoteStreams(): MediaStream[]; - getStats(selector: MediaStreamTrack | null, successCallback?: RTCStatsCallback, failureCallback?: RTCPeerConnectionErrorCallback): PromiseLike; + getStats(selector: MediaStreamTrack | null, successCallback?: RTCStatsCallback, failureCallback?: RTCPeerConnectionErrorCallback): Promise; getStreamById(streamId: string): MediaStream | null; removeStream(stream: MediaStream): void; - setLocalDescription(description: RTCSessionDescription, successCallback?: VoidFunction, failureCallback?: RTCPeerConnectionErrorCallback): PromiseLike; - setRemoteDescription(description: RTCSessionDescription, successCallback?: VoidFunction, failureCallback?: RTCPeerConnectionErrorCallback): PromiseLike; + setLocalDescription(description: RTCSessionDescription, successCallback?: VoidFunction, failureCallback?: RTCPeerConnectionErrorCallback): Promise; + setRemoteDescription(description: RTCSessionDescription, successCallback?: VoidFunction, failureCallback?: RTCPeerConnectionErrorCallback): Promise; addEventListener(type: K, listener: (this: RTCPeerConnection, ev: RTCPeerConnectionEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13443,8 +13494,8 @@ declare var RTCSsrcConflictEvent: { } interface RTCStatsProvider extends EventTarget { - getStats(): PromiseLike; - msGetStats(): PromiseLike; + getStats(): Promise; + msGetStats(): Promise; } declare var RTCStatsProvider: { @@ -13498,7 +13549,7 @@ declare var Range: { interface ReadableStream { readonly locked: boolean; - cancel(): PromiseLike; + cancel(): Promise; getReader(): ReadableStreamReader; } @@ -13508,8 +13559,8 @@ declare var ReadableStream: { } interface ReadableStreamReader { - cancel(): PromiseLike; - read(): PromiseLike; + cancel(): Promise; + read(): Promise; releaseLock(): void; } @@ -15483,10 +15534,10 @@ interface ServiceWorkerContainer extends EventTarget { readonly controller: ServiceWorker | null; oncontrollerchange: (this: ServiceWorkerContainer, ev: Event) => any; onmessage: (this: ServiceWorkerContainer, ev: ServiceWorkerMessageEvent) => any; - readonly ready: PromiseLike; - getRegistration(clientURL?: USVString): PromiseLike; + readonly ready: Promise; + getRegistration(clientURL?: USVString): Promise; getRegistrations(): any; - register(scriptURL: USVString, options?: RegistrationOptions): PromiseLike; + register(scriptURL: USVString, options?: RegistrationOptions): Promise; addEventListener(type: K, listener: (this: ServiceWorkerContainer, ev: ServiceWorkerContainerEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15522,9 +15573,9 @@ interface ServiceWorkerRegistration extends EventTarget { readonly sync: SyncManager; readonly waiting: ServiceWorker | null; getNotifications(filter?: GetNotificationOptions): any; - showNotification(title: string, options?: NotificationOptions): PromiseLike; - unregister(): PromiseLike; - update(): PromiseLike; + showNotification(title: string, options?: NotificationOptions): Promise; + unregister(): Promise; + update(): Promise; addEventListener(type: K, listener: (this: ServiceWorkerRegistration, ev: ServiceWorkerRegistrationEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15759,7 +15810,7 @@ declare var SubtleCrypto: { interface SyncManager { getTags(): any; - register(tag: string): PromiseLike; + register(tag: string): Promise; } declare var SyncManager: { @@ -16173,8 +16224,8 @@ declare var WaveShaperNode: { } interface WebAuthentication { - getAssertion(assertionChallenge: any, options?: AssertionOptions): PromiseLike; - makeCredential(accountInformation: Account, cryptoParameters: ScopedCredentialParameters[], attestationChallenge: any, options?: ScopedCredentialOptions): PromiseLike; + getAssertion(assertionChallenge: any, options?: AssertionOptions): Promise; + makeCredential(accountInformation: Account, cryptoParameters: ScopedCredentialParameters[], attestationChallenge: any, options?: ScopedCredentialOptions): Promise; } declare var WebAuthentication: { @@ -17667,10 +17718,10 @@ interface AbstractWorker { interface Body { readonly bodyUsed: boolean; - arrayBuffer(): PromiseLike; - blob(): PromiseLike; - json(): PromiseLike; - text(): PromiseLike; + arrayBuffer(): Promise; + blob(): Promise; + json(): Promise; + text(): Promise; } interface CanvasPathMethods { @@ -17811,7 +17862,7 @@ interface GlobalEventHandlers { } interface GlobalFetch { - fetch(input: RequestInfo, init?: RequestInit): PromiseLike; + fetch(input: RequestInfo, init?: RequestInit): Promise; } interface HTMLTableAlignment { @@ -19068,7 +19119,7 @@ declare var onwheel: (this: Window, ev: WheelEvent) => any; declare var indexedDB: IDBFactory; declare function atob(encodedString: string): string; declare function btoa(rawString: string): string; -declare function fetch(input: RequestInfo, init?: RequestInit): PromiseLike; +declare function fetch(input: RequestInfo, init?: RequestInit): Promise; declare function addEventListener(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void; declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; type AAGUID = string; diff --git a/lib/lib.dom.d.ts b/lib/lib.dom.d.ts index c87cfa6eb77..39a0c3da684 100644 --- a/lib/lib.dom.d.ts +++ b/lib/lib.dom.d.ts @@ -1351,7 +1351,7 @@ interface AudioContextBase extends EventTarget { onstatechange: (this: AudioContext, ev: Event) => any; readonly sampleRate: number; readonly state: string; - close(): PromiseLike; + close(): Promise; createAnalyser(): AnalyserNode; createBiquadFilter(): BiquadFilterNode; createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer; @@ -1371,14 +1371,14 @@ interface AudioContextBase extends EventTarget { createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; createStereoPanner(): StereoPannerNode; createWaveShaper(): WaveShaperNode; - decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): PromiseLike; - resume(): PromiseLike; + decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): Promise; + resume(): Promise; addEventListener(type: K, listener: (this: AudioContext, ev: AudioContextEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } interface AudioContext extends AudioContextBase { - suspend(): PromiseLike; + suspend(): Promise; } declare var AudioContext: { @@ -2096,13 +2096,13 @@ declare var CSSSupportsRule: { } interface Cache { - add(request: RequestInfo): PromiseLike; - addAll(requests: RequestInfo[]): PromiseLike; - delete(request: RequestInfo, options?: CacheQueryOptions): PromiseLike; + add(request: RequestInfo): Promise; + addAll(requests: RequestInfo[]): Promise; + delete(request: RequestInfo, options?: CacheQueryOptions): Promise; keys(request?: RequestInfo, options?: CacheQueryOptions): any; - match(request: RequestInfo, options?: CacheQueryOptions): PromiseLike; + match(request: RequestInfo, options?: CacheQueryOptions): Promise; matchAll(request?: RequestInfo, options?: CacheQueryOptions): any; - put(request: RequestInfo, response: Response): PromiseLike; + put(request: RequestInfo, response: Response): Promise; } declare var Cache: { @@ -2111,11 +2111,11 @@ declare var Cache: { } interface CacheStorage { - delete(cacheName: string): PromiseLike; - has(cacheName: string): PromiseLike; + delete(cacheName: string): Promise; + has(cacheName: string): Promise; keys(): any; - match(request: RequestInfo, options?: CacheQueryOptions): PromiseLike; - open(cacheName: string): PromiseLike; + match(request: RequestInfo, options?: CacheQueryOptions): Promise; + open(cacheName: string): Promise; } declare var CacheStorage: { @@ -5736,7 +5736,7 @@ interface HTMLMediaElement extends HTMLElement { * Loads and starts playback of a media resource. */ play(): void; - setMediaKeys(mediaKeys: MediaKeys | null): PromiseLike; + setMediaKeys(mediaKeys: MediaKeys | null): Promise; readonly HAVE_CURRENT_DATA: number; readonly HAVE_ENOUGH_DATA: number; readonly HAVE_FUTURE_DATA: number; @@ -7314,7 +7314,7 @@ interface MSApp { execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; getCurrentPriority(): string; - getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike; + getHtmlPrintDocumentSourceAsync(htmlDoc: any): Promise; getViewId(view: any): any; isTaskScheduledAtPriorityOrHigher(priority: string): boolean; pageHandlesAllApplicationActivations(enabled: boolean): void; @@ -7375,8 +7375,8 @@ declare var MSBlobBuilder: { } interface MSCredentials { - getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): PromiseLike; - makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): PromiseLike; + getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): Promise; + makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): Promise; } declare var MSCredentials: { @@ -7764,7 +7764,7 @@ interface MediaDevices extends EventTarget { ondevicechange: (this: MediaDevices, ev: Event) => any; enumerateDevices(): any; getSupportedConstraints(): MediaTrackSupportedConstraints; - getUserMedia(constraints: MediaStreamConstraints): PromiseLike; + getUserMedia(constraints: MediaStreamConstraints): Promise; addEventListener(type: K, listener: (this: MediaDevices, ev: MediaDevicesEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -7823,15 +7823,15 @@ declare var MediaKeyMessageEvent: { } interface MediaKeySession extends EventTarget { - readonly closed: PromiseLike; + readonly closed: Promise; readonly expiration: number; readonly keyStatuses: MediaKeyStatusMap; readonly sessionId: string; - close(): PromiseLike; - generateRequest(initDataType: string, initData: any): PromiseLike; - load(sessionId: string): PromiseLike; - remove(): PromiseLike; - update(response: any): PromiseLike; + close(): Promise; + generateRequest(initDataType: string, initData: any): Promise; + load(sessionId: string): Promise; + remove(): Promise; + update(response: any): Promise; } declare var MediaKeySession: { @@ -7853,7 +7853,7 @@ declare var MediaKeyStatusMap: { interface MediaKeySystemAccess { readonly keySystem: string; - createMediaKeys(): PromiseLike; + createMediaKeys(): Promise; getConfiguration(): MediaKeySystemConfiguration; } @@ -7864,7 +7864,7 @@ declare var MediaKeySystemAccess: { interface MediaKeys { createSession(sessionType?: string): MediaKeySession; - setServerCertificate(serverCertificate: any): PromiseLike; + setServerCertificate(serverCertificate: any): Promise; } declare var MediaKeys: { @@ -8003,7 +8003,7 @@ interface MediaStreamTrack extends EventTarget { readonly readonly: boolean; readonly readyState: string; readonly remote: boolean; - applyConstraints(constraints: MediaTrackConstraints): PromiseLike; + applyConstraints(constraints: MediaTrackConstraints): Promise; clone(): MediaStreamTrack; getCapabilities(): MediaTrackCapabilities; getConstraints(): MediaTrackConstraints; @@ -8237,7 +8237,7 @@ interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorConte getGamepads(): Gamepad[]; javaEnabled(): boolean; msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void; - requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike; + requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): Promise; vibrate(pattern: number | number[]): boolean; } @@ -8397,7 +8397,7 @@ interface Notification extends EventTarget { declare var Notification: { prototype: Notification; new(title: string, options?: NotificationOptions): Notification; - requestPermission(callback?: NotificationPermissionCallback): PromiseLike; + requestPermission(callback?: NotificationPermissionCallback): Promise; } interface OES_element_index_uint { @@ -8468,8 +8468,8 @@ interface OfflineAudioContextEventMap extends AudioContextEventMap { interface OfflineAudioContext extends AudioContextBase { readonly length: number; oncomplete: (this: OfflineAudioContext, ev: OfflineAudioCompletionEvent) => any; - startRendering(): PromiseLike; - suspend(suspendTime: number): PromiseLike; + startRendering(): Promise; + suspend(suspendTime: number): Promise; addEventListener(type: K, listener: (this: OfflineAudioContext, ev: OfflineAudioContextEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8584,8 +8584,8 @@ interface PaymentRequest extends EventTarget { readonly shippingAddress: PaymentAddress | null; readonly shippingOption: string | null; readonly shippingType: string | null; - abort(): PromiseLike; - show(): PromiseLike; + abort(): Promise; + show(): Promise; addEventListener(type: K, listener: (this: PaymentRequest, ev: PaymentRequestEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8596,7 +8596,7 @@ declare var PaymentRequest: { } interface PaymentRequestUpdateEvent extends Event { - updateWith(d: PromiseLike): void; + updateWith(d: Promise): void; } declare var PaymentRequestUpdateEvent: { @@ -8612,7 +8612,7 @@ interface PaymentResponse { readonly payerPhone: string | null; readonly shippingAddress: PaymentAddress | null; readonly shippingOption: string | null; - complete(result?: string): PromiseLike; + complete(result?: string): Promise; toJSON(): any; } @@ -8938,9 +8938,9 @@ declare var ProgressEvent: { } interface PushManager { - getSubscription(): PromiseLike; - permissionState(options?: PushSubscriptionOptionsInit): PromiseLike; - subscribe(options?: PushSubscriptionOptionsInit): PromiseLike; + getSubscription(): Promise; + permissionState(options?: PushSubscriptionOptionsInit): Promise; + subscribe(options?: PushSubscriptionOptionsInit): Promise; } declare var PushManager: { @@ -8953,7 +8953,7 @@ interface PushSubscription { readonly options: PushSubscriptionOptions; getKey(name: string): ArrayBuffer | null; toJSON(): any; - unsubscribe(): PromiseLike; + unsubscribe(): Promise; } declare var PushSubscription: { @@ -9147,19 +9147,19 @@ interface RTCPeerConnection extends EventTarget { onsignalingstatechange: (this: RTCPeerConnection, ev: Event) => any; readonly remoteDescription: RTCSessionDescription | null; readonly signalingState: string; - addIceCandidate(candidate: RTCIceCandidate, successCallback?: VoidFunction, failureCallback?: RTCPeerConnectionErrorCallback): PromiseLike; + addIceCandidate(candidate: RTCIceCandidate, successCallback?: VoidFunction, failureCallback?: RTCPeerConnectionErrorCallback): Promise; addStream(stream: MediaStream): void; close(): void; - createAnswer(successCallback?: RTCSessionDescriptionCallback, failureCallback?: RTCPeerConnectionErrorCallback): PromiseLike; - createOffer(successCallback?: RTCSessionDescriptionCallback, failureCallback?: RTCPeerConnectionErrorCallback, options?: RTCOfferOptions): PromiseLike; + createAnswer(successCallback?: RTCSessionDescriptionCallback, failureCallback?: RTCPeerConnectionErrorCallback): Promise; + createOffer(successCallback?: RTCSessionDescriptionCallback, failureCallback?: RTCPeerConnectionErrorCallback, options?: RTCOfferOptions): Promise; getConfiguration(): RTCConfiguration; getLocalStreams(): MediaStream[]; getRemoteStreams(): MediaStream[]; - getStats(selector: MediaStreamTrack | null, successCallback?: RTCStatsCallback, failureCallback?: RTCPeerConnectionErrorCallback): PromiseLike; + getStats(selector: MediaStreamTrack | null, successCallback?: RTCStatsCallback, failureCallback?: RTCPeerConnectionErrorCallback): Promise; getStreamById(streamId: string): MediaStream | null; removeStream(stream: MediaStream): void; - setLocalDescription(description: RTCSessionDescription, successCallback?: VoidFunction, failureCallback?: RTCPeerConnectionErrorCallback): PromiseLike; - setRemoteDescription(description: RTCSessionDescription, successCallback?: VoidFunction, failureCallback?: RTCPeerConnectionErrorCallback): PromiseLike; + setLocalDescription(description: RTCSessionDescription, successCallback?: VoidFunction, failureCallback?: RTCPeerConnectionErrorCallback): Promise; + setRemoteDescription(description: RTCSessionDescription, successCallback?: VoidFunction, failureCallback?: RTCPeerConnectionErrorCallback): Promise; addEventListener(type: K, listener: (this: RTCPeerConnection, ev: RTCPeerConnectionEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9265,8 +9265,8 @@ declare var RTCSsrcConflictEvent: { } interface RTCStatsProvider extends EventTarget { - getStats(): PromiseLike; - msGetStats(): PromiseLike; + getStats(): Promise; + msGetStats(): Promise; } declare var RTCStatsProvider: { @@ -9320,7 +9320,7 @@ declare var Range: { interface ReadableStream { readonly locked: boolean; - cancel(): PromiseLike; + cancel(): Promise; getReader(): ReadableStreamReader; } @@ -9330,8 +9330,8 @@ declare var ReadableStream: { } interface ReadableStreamReader { - cancel(): PromiseLike; - read(): PromiseLike; + cancel(): Promise; + read(): Promise; releaseLock(): void; } @@ -11305,10 +11305,10 @@ interface ServiceWorkerContainer extends EventTarget { readonly controller: ServiceWorker | null; oncontrollerchange: (this: ServiceWorkerContainer, ev: Event) => any; onmessage: (this: ServiceWorkerContainer, ev: ServiceWorkerMessageEvent) => any; - readonly ready: PromiseLike; - getRegistration(clientURL?: USVString): PromiseLike; + readonly ready: Promise; + getRegistration(clientURL?: USVString): Promise; getRegistrations(): any; - register(scriptURL: USVString, options?: RegistrationOptions): PromiseLike; + register(scriptURL: USVString, options?: RegistrationOptions): Promise; addEventListener(type: K, listener: (this: ServiceWorkerContainer, ev: ServiceWorkerContainerEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11344,9 +11344,9 @@ interface ServiceWorkerRegistration extends EventTarget { readonly sync: SyncManager; readonly waiting: ServiceWorker | null; getNotifications(filter?: GetNotificationOptions): any; - showNotification(title: string, options?: NotificationOptions): PromiseLike; - unregister(): PromiseLike; - update(): PromiseLike; + showNotification(title: string, options?: NotificationOptions): Promise; + unregister(): Promise; + update(): Promise; addEventListener(type: K, listener: (this: ServiceWorkerRegistration, ev: ServiceWorkerRegistrationEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11581,7 +11581,7 @@ declare var SubtleCrypto: { interface SyncManager { getTags(): any; - register(tag: string): PromiseLike; + register(tag: string): Promise; } declare var SyncManager: { @@ -11995,8 +11995,8 @@ declare var WaveShaperNode: { } interface WebAuthentication { - getAssertion(assertionChallenge: any, options?: AssertionOptions): PromiseLike; - makeCredential(accountInformation: Account, cryptoParameters: ScopedCredentialParameters[], attestationChallenge: any, options?: ScopedCredentialOptions): PromiseLike; + getAssertion(assertionChallenge: any, options?: AssertionOptions): Promise; + makeCredential(accountInformation: Account, cryptoParameters: ScopedCredentialParameters[], attestationChallenge: any, options?: ScopedCredentialOptions): Promise; } declare var WebAuthentication: { @@ -13489,10 +13489,10 @@ interface AbstractWorker { interface Body { readonly bodyUsed: boolean; - arrayBuffer(): PromiseLike; - blob(): PromiseLike; - json(): PromiseLike; - text(): PromiseLike; + arrayBuffer(): Promise; + blob(): Promise; + json(): Promise; + text(): Promise; } interface CanvasPathMethods { @@ -13633,7 +13633,7 @@ interface GlobalEventHandlers { } interface GlobalFetch { - fetch(input: RequestInfo, init?: RequestInit): PromiseLike; + fetch(input: RequestInfo, init?: RequestInit): Promise; } interface HTMLTableAlignment { @@ -14890,7 +14890,7 @@ declare var onwheel: (this: Window, ev: WheelEvent) => any; declare var indexedDB: IDBFactory; declare function atob(encodedString: string): string; declare function btoa(rawString: string): string; -declare function fetch(input: RequestInfo, init?: RequestInit): PromiseLike; +declare function fetch(input: RequestInfo, init?: RequestInit): Promise; declare function addEventListener(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void; declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; type AAGUID = string; diff --git a/lib/lib.es2015.promise.d.ts b/lib/lib.es2015.promise.d.ts index 99df9263ea1..51d1053e120 100644 --- a/lib/lib.es2015.promise.d.ts +++ b/lib/lib.es2015.promise.d.ts @@ -18,56 +18,6 @@ and limitations under the License. /// -/** - * Represents the completion of an asynchronous operation - */ -interface Promise { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: ((value: T) => T | PromiseLike) | undefined | null, onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): Promise; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled: ((value: T) => T | PromiseLike) | undefined | null, onrejected: (reason: any) => TResult | PromiseLike): Promise; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled: (value: T) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled: (value: T) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; - - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): Promise; - - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected: (reason: any) => TResult | PromiseLike): Promise; -} interface PromiseConstructor { /** diff --git a/lib/lib.es5.d.ts b/lib/lib.es5.d.ts index 549cfab1546..764daf82a6b 100644 --- a/lib/lib.es5.d.ts +++ b/lib/lib.es5.d.ts @@ -361,14 +361,14 @@ interface String { /** * Replaces text in a string, using a regular expression or search string. - * @param searchValue A string that represents the regular expression. + * @param searchValue A string to search for. * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. */ replace(searchValue: string, replaceValue: string): string; /** * Replaces text in a string, using a regular expression or search string. - * @param searchValue A string that represents the regular expression. + * @param searchValue A string to search for. * @param replacer A function that returns the replacement text. */ replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; @@ -1371,6 +1371,57 @@ interface PromiseLike { onrejected: (reason: any) => TResult2 | PromiseLike): PromiseLike; } +/** + * Represents the completion of an asynchronous operation + */ +interface Promise { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => T | PromiseLike) | undefined | null, onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): Promise; + + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled: ((value: T) => T | PromiseLike) | undefined | null, onrejected: (reason: any) => TResult | PromiseLike): Promise; + + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled: (value: T) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise; + + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled: (value: T) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; + + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): Promise; + + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected: (reason: any) => TResult | PromiseLike): Promise; +} + interface ArrayLike { readonly length: number; readonly [n: number]: T; diff --git a/lib/lib.es6.d.ts b/lib/lib.es6.d.ts index 29e6a9acb1c..2207f1a4e81 100644 --- a/lib/lib.es6.d.ts +++ b/lib/lib.es6.d.ts @@ -361,14 +361,14 @@ interface String { /** * Replaces text in a string, using a regular expression or search string. - * @param searchValue A string that represents the regular expression. + * @param searchValue A string to search for. * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. */ replace(searchValue: string, replaceValue: string): string; /** * Replaces text in a string, using a regular expression or search string. - * @param searchValue A string that represents the regular expression. + * @param searchValue A string to search for. * @param replacer A function that returns the replacement text. */ replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; @@ -1371,6 +1371,57 @@ interface PromiseLike { onrejected: (reason: any) => TResult2 | PromiseLike): PromiseLike; } +/** + * Represents the completion of an asynchronous operation + */ +interface Promise { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => T | PromiseLike) | undefined | null, onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): Promise; + + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled: ((value: T) => T | PromiseLike) | undefined | null, onrejected: (reason: any) => TResult | PromiseLike): Promise; + + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled: (value: T) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise; + + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled: (value: T) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; + + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): Promise; + + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected: (reason: any) => TResult | PromiseLike): Promise; +} + interface ArrayLike { readonly length: number; readonly [n: number]: T; @@ -5257,56 +5308,6 @@ interface Float64ArrayConstructor { } -/** - * Represents the completion of an asynchronous operation - */ -interface Promise { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: ((value: T) => T | PromiseLike) | undefined | null, onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): Promise; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled: ((value: T) => T | PromiseLike) | undefined | null, onrejected: (reason: any) => TResult | PromiseLike): Promise; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled: (value: T) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled: (value: T) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; - - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): Promise; - - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected: (reason: any) => TResult | PromiseLike): Promise; -} interface PromiseConstructor { /** @@ -7251,7 +7252,7 @@ interface AudioContextBase extends EventTarget { onstatechange: (this: AudioContext, ev: Event) => any; readonly sampleRate: number; readonly state: string; - close(): PromiseLike; + close(): Promise; createAnalyser(): AnalyserNode; createBiquadFilter(): BiquadFilterNode; createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer; @@ -7271,14 +7272,14 @@ interface AudioContextBase extends EventTarget { createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; createStereoPanner(): StereoPannerNode; createWaveShaper(): WaveShaperNode; - decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): PromiseLike; - resume(): PromiseLike; + decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): Promise; + resume(): Promise; addEventListener(type: K, listener: (this: AudioContext, ev: AudioContextEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } interface AudioContext extends AudioContextBase { - suspend(): PromiseLike; + suspend(): Promise; } declare var AudioContext: { @@ -7996,13 +7997,13 @@ declare var CSSSupportsRule: { } interface Cache { - add(request: RequestInfo): PromiseLike; - addAll(requests: RequestInfo[]): PromiseLike; - delete(request: RequestInfo, options?: CacheQueryOptions): PromiseLike; + add(request: RequestInfo): Promise; + addAll(requests: RequestInfo[]): Promise; + delete(request: RequestInfo, options?: CacheQueryOptions): Promise; keys(request?: RequestInfo, options?: CacheQueryOptions): any; - match(request: RequestInfo, options?: CacheQueryOptions): PromiseLike; + match(request: RequestInfo, options?: CacheQueryOptions): Promise; matchAll(request?: RequestInfo, options?: CacheQueryOptions): any; - put(request: RequestInfo, response: Response): PromiseLike; + put(request: RequestInfo, response: Response): Promise; } declare var Cache: { @@ -8011,11 +8012,11 @@ declare var Cache: { } interface CacheStorage { - delete(cacheName: string): PromiseLike; - has(cacheName: string): PromiseLike; + delete(cacheName: string): Promise; + has(cacheName: string): Promise; keys(): any; - match(request: RequestInfo, options?: CacheQueryOptions): PromiseLike; - open(cacheName: string): PromiseLike; + match(request: RequestInfo, options?: CacheQueryOptions): Promise; + open(cacheName: string): Promise; } declare var CacheStorage: { @@ -11636,7 +11637,7 @@ interface HTMLMediaElement extends HTMLElement { * Loads and starts playback of a media resource. */ play(): void; - setMediaKeys(mediaKeys: MediaKeys | null): PromiseLike; + setMediaKeys(mediaKeys: MediaKeys | null): Promise; readonly HAVE_CURRENT_DATA: number; readonly HAVE_ENOUGH_DATA: number; readonly HAVE_FUTURE_DATA: number; @@ -13214,7 +13215,7 @@ interface MSApp { execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; getCurrentPriority(): string; - getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike; + getHtmlPrintDocumentSourceAsync(htmlDoc: any): Promise; getViewId(view: any): any; isTaskScheduledAtPriorityOrHigher(priority: string): boolean; pageHandlesAllApplicationActivations(enabled: boolean): void; @@ -13275,8 +13276,8 @@ declare var MSBlobBuilder: { } interface MSCredentials { - getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): PromiseLike; - makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): PromiseLike; + getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): Promise; + makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): Promise; } declare var MSCredentials: { @@ -13664,7 +13665,7 @@ interface MediaDevices extends EventTarget { ondevicechange: (this: MediaDevices, ev: Event) => any; enumerateDevices(): any; getSupportedConstraints(): MediaTrackSupportedConstraints; - getUserMedia(constraints: MediaStreamConstraints): PromiseLike; + getUserMedia(constraints: MediaStreamConstraints): Promise; addEventListener(type: K, listener: (this: MediaDevices, ev: MediaDevicesEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13723,15 +13724,15 @@ declare var MediaKeyMessageEvent: { } interface MediaKeySession extends EventTarget { - readonly closed: PromiseLike; + readonly closed: Promise; readonly expiration: number; readonly keyStatuses: MediaKeyStatusMap; readonly sessionId: string; - close(): PromiseLike; - generateRequest(initDataType: string, initData: any): PromiseLike; - load(sessionId: string): PromiseLike; - remove(): PromiseLike; - update(response: any): PromiseLike; + close(): Promise; + generateRequest(initDataType: string, initData: any): Promise; + load(sessionId: string): Promise; + remove(): Promise; + update(response: any): Promise; } declare var MediaKeySession: { @@ -13753,7 +13754,7 @@ declare var MediaKeyStatusMap: { interface MediaKeySystemAccess { readonly keySystem: string; - createMediaKeys(): PromiseLike; + createMediaKeys(): Promise; getConfiguration(): MediaKeySystemConfiguration; } @@ -13764,7 +13765,7 @@ declare var MediaKeySystemAccess: { interface MediaKeys { createSession(sessionType?: string): MediaKeySession; - setServerCertificate(serverCertificate: any): PromiseLike; + setServerCertificate(serverCertificate: any): Promise; } declare var MediaKeys: { @@ -13903,7 +13904,7 @@ interface MediaStreamTrack extends EventTarget { readonly readonly: boolean; readonly readyState: string; readonly remote: boolean; - applyConstraints(constraints: MediaTrackConstraints): PromiseLike; + applyConstraints(constraints: MediaTrackConstraints): Promise; clone(): MediaStreamTrack; getCapabilities(): MediaTrackCapabilities; getConstraints(): MediaTrackConstraints; @@ -14137,7 +14138,7 @@ interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorConte getGamepads(): Gamepad[]; javaEnabled(): boolean; msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void; - requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike; + requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): Promise; vibrate(pattern: number | number[]): boolean; } @@ -14297,7 +14298,7 @@ interface Notification extends EventTarget { declare var Notification: { prototype: Notification; new(title: string, options?: NotificationOptions): Notification; - requestPermission(callback?: NotificationPermissionCallback): PromiseLike; + requestPermission(callback?: NotificationPermissionCallback): Promise; } interface OES_element_index_uint { @@ -14368,8 +14369,8 @@ interface OfflineAudioContextEventMap extends AudioContextEventMap { interface OfflineAudioContext extends AudioContextBase { readonly length: number; oncomplete: (this: OfflineAudioContext, ev: OfflineAudioCompletionEvent) => any; - startRendering(): PromiseLike; - suspend(suspendTime: number): PromiseLike; + startRendering(): Promise; + suspend(suspendTime: number): Promise; addEventListener(type: K, listener: (this: OfflineAudioContext, ev: OfflineAudioContextEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14484,8 +14485,8 @@ interface PaymentRequest extends EventTarget { readonly shippingAddress: PaymentAddress | null; readonly shippingOption: string | null; readonly shippingType: string | null; - abort(): PromiseLike; - show(): PromiseLike; + abort(): Promise; + show(): Promise; addEventListener(type: K, listener: (this: PaymentRequest, ev: PaymentRequestEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14496,7 +14497,7 @@ declare var PaymentRequest: { } interface PaymentRequestUpdateEvent extends Event { - updateWith(d: PromiseLike): void; + updateWith(d: Promise): void; } declare var PaymentRequestUpdateEvent: { @@ -14512,7 +14513,7 @@ interface PaymentResponse { readonly payerPhone: string | null; readonly shippingAddress: PaymentAddress | null; readonly shippingOption: string | null; - complete(result?: string): PromiseLike; + complete(result?: string): Promise; toJSON(): any; } @@ -14838,9 +14839,9 @@ declare var ProgressEvent: { } interface PushManager { - getSubscription(): PromiseLike; - permissionState(options?: PushSubscriptionOptionsInit): PromiseLike; - subscribe(options?: PushSubscriptionOptionsInit): PromiseLike; + getSubscription(): Promise; + permissionState(options?: PushSubscriptionOptionsInit): Promise; + subscribe(options?: PushSubscriptionOptionsInit): Promise; } declare var PushManager: { @@ -14853,7 +14854,7 @@ interface PushSubscription { readonly options: PushSubscriptionOptions; getKey(name: string): ArrayBuffer | null; toJSON(): any; - unsubscribe(): PromiseLike; + unsubscribe(): Promise; } declare var PushSubscription: { @@ -15047,19 +15048,19 @@ interface RTCPeerConnection extends EventTarget { onsignalingstatechange: (this: RTCPeerConnection, ev: Event) => any; readonly remoteDescription: RTCSessionDescription | null; readonly signalingState: string; - addIceCandidate(candidate: RTCIceCandidate, successCallback?: VoidFunction, failureCallback?: RTCPeerConnectionErrorCallback): PromiseLike; + addIceCandidate(candidate: RTCIceCandidate, successCallback?: VoidFunction, failureCallback?: RTCPeerConnectionErrorCallback): Promise; addStream(stream: MediaStream): void; close(): void; - createAnswer(successCallback?: RTCSessionDescriptionCallback, failureCallback?: RTCPeerConnectionErrorCallback): PromiseLike; - createOffer(successCallback?: RTCSessionDescriptionCallback, failureCallback?: RTCPeerConnectionErrorCallback, options?: RTCOfferOptions): PromiseLike; + createAnswer(successCallback?: RTCSessionDescriptionCallback, failureCallback?: RTCPeerConnectionErrorCallback): Promise; + createOffer(successCallback?: RTCSessionDescriptionCallback, failureCallback?: RTCPeerConnectionErrorCallback, options?: RTCOfferOptions): Promise; getConfiguration(): RTCConfiguration; getLocalStreams(): MediaStream[]; getRemoteStreams(): MediaStream[]; - getStats(selector: MediaStreamTrack | null, successCallback?: RTCStatsCallback, failureCallback?: RTCPeerConnectionErrorCallback): PromiseLike; + getStats(selector: MediaStreamTrack | null, successCallback?: RTCStatsCallback, failureCallback?: RTCPeerConnectionErrorCallback): Promise; getStreamById(streamId: string): MediaStream | null; removeStream(stream: MediaStream): void; - setLocalDescription(description: RTCSessionDescription, successCallback?: VoidFunction, failureCallback?: RTCPeerConnectionErrorCallback): PromiseLike; - setRemoteDescription(description: RTCSessionDescription, successCallback?: VoidFunction, failureCallback?: RTCPeerConnectionErrorCallback): PromiseLike; + setLocalDescription(description: RTCSessionDescription, successCallback?: VoidFunction, failureCallback?: RTCPeerConnectionErrorCallback): Promise; + setRemoteDescription(description: RTCSessionDescription, successCallback?: VoidFunction, failureCallback?: RTCPeerConnectionErrorCallback): Promise; addEventListener(type: K, listener: (this: RTCPeerConnection, ev: RTCPeerConnectionEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15165,8 +15166,8 @@ declare var RTCSsrcConflictEvent: { } interface RTCStatsProvider extends EventTarget { - getStats(): PromiseLike; - msGetStats(): PromiseLike; + getStats(): Promise; + msGetStats(): Promise; } declare var RTCStatsProvider: { @@ -15220,7 +15221,7 @@ declare var Range: { interface ReadableStream { readonly locked: boolean; - cancel(): PromiseLike; + cancel(): Promise; getReader(): ReadableStreamReader; } @@ -15230,8 +15231,8 @@ declare var ReadableStream: { } interface ReadableStreamReader { - cancel(): PromiseLike; - read(): PromiseLike; + cancel(): Promise; + read(): Promise; releaseLock(): void; } @@ -17205,10 +17206,10 @@ interface ServiceWorkerContainer extends EventTarget { readonly controller: ServiceWorker | null; oncontrollerchange: (this: ServiceWorkerContainer, ev: Event) => any; onmessage: (this: ServiceWorkerContainer, ev: ServiceWorkerMessageEvent) => any; - readonly ready: PromiseLike; - getRegistration(clientURL?: USVString): PromiseLike; + readonly ready: Promise; + getRegistration(clientURL?: USVString): Promise; getRegistrations(): any; - register(scriptURL: USVString, options?: RegistrationOptions): PromiseLike; + register(scriptURL: USVString, options?: RegistrationOptions): Promise; addEventListener(type: K, listener: (this: ServiceWorkerContainer, ev: ServiceWorkerContainerEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -17244,9 +17245,9 @@ interface ServiceWorkerRegistration extends EventTarget { readonly sync: SyncManager; readonly waiting: ServiceWorker | null; getNotifications(filter?: GetNotificationOptions): any; - showNotification(title: string, options?: NotificationOptions): PromiseLike; - unregister(): PromiseLike; - update(): PromiseLike; + showNotification(title: string, options?: NotificationOptions): Promise; + unregister(): Promise; + update(): Promise; addEventListener(type: K, listener: (this: ServiceWorkerRegistration, ev: ServiceWorkerRegistrationEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -17481,7 +17482,7 @@ declare var SubtleCrypto: { interface SyncManager { getTags(): any; - register(tag: string): PromiseLike; + register(tag: string): Promise; } declare var SyncManager: { @@ -17895,8 +17896,8 @@ declare var WaveShaperNode: { } interface WebAuthentication { - getAssertion(assertionChallenge: any, options?: AssertionOptions): PromiseLike; - makeCredential(accountInformation: Account, cryptoParameters: ScopedCredentialParameters[], attestationChallenge: any, options?: ScopedCredentialOptions): PromiseLike; + getAssertion(assertionChallenge: any, options?: AssertionOptions): Promise; + makeCredential(accountInformation: Account, cryptoParameters: ScopedCredentialParameters[], attestationChallenge: any, options?: ScopedCredentialOptions): Promise; } declare var WebAuthentication: { @@ -19389,10 +19390,10 @@ interface AbstractWorker { interface Body { readonly bodyUsed: boolean; - arrayBuffer(): PromiseLike; - blob(): PromiseLike; - json(): PromiseLike; - text(): PromiseLike; + arrayBuffer(): Promise; + blob(): Promise; + json(): Promise; + text(): Promise; } interface CanvasPathMethods { @@ -19533,7 +19534,7 @@ interface GlobalEventHandlers { } interface GlobalFetch { - fetch(input: RequestInfo, init?: RequestInit): PromiseLike; + fetch(input: RequestInfo, init?: RequestInit): Promise; } interface HTMLTableAlignment { @@ -20790,7 +20791,7 @@ declare var onwheel: (this: Window, ev: WheelEvent) => any; declare var indexedDB: IDBFactory; declare function atob(encodedString: string): string; declare function btoa(rawString: string): string; -declare function fetch(input: RequestInfo, init?: RequestInit): PromiseLike; +declare function fetch(input: RequestInfo, init?: RequestInit): Promise; declare function addEventListener(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void; declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; type AAGUID = string; diff --git a/lib/lib.webworker.d.ts b/lib/lib.webworker.d.ts index dcffddfe5d0..e20455cf59e 100644 --- a/lib/lib.webworker.d.ts +++ b/lib/lib.webworker.d.ts @@ -188,13 +188,13 @@ declare var Blob: { } interface Cache { - add(request: RequestInfo): PromiseLike; - addAll(requests: RequestInfo[]): PromiseLike; - delete(request: RequestInfo, options?: CacheQueryOptions): PromiseLike; + add(request: RequestInfo): Promise; + addAll(requests: RequestInfo[]): Promise; + delete(request: RequestInfo, options?: CacheQueryOptions): Promise; keys(request?: RequestInfo, options?: CacheQueryOptions): any; - match(request: RequestInfo, options?: CacheQueryOptions): PromiseLike; + match(request: RequestInfo, options?: CacheQueryOptions): Promise; matchAll(request?: RequestInfo, options?: CacheQueryOptions): any; - put(request: RequestInfo, response: Response): PromiseLike; + put(request: RequestInfo, response: Response): Promise; } declare var Cache: { @@ -203,11 +203,11 @@ declare var Cache: { } interface CacheStorage { - delete(cacheName: string): PromiseLike; - has(cacheName: string): PromiseLike; + delete(cacheName: string): Promise; + has(cacheName: string): Promise; keys(): any; - match(request: RequestInfo, options?: CacheQueryOptions): PromiseLike; - open(cacheName: string): PromiseLike; + match(request: RequestInfo, options?: CacheQueryOptions): Promise; + open(cacheName: string): Promise; } declare var CacheStorage: { @@ -766,7 +766,7 @@ interface Notification extends EventTarget { declare var Notification: { prototype: Notification; new(title: string, options?: NotificationOptions): Notification; - requestPermission(callback?: NotificationPermissionCallback): PromiseLike; + requestPermission(callback?: NotificationPermissionCallback): Promise; } interface Performance { @@ -882,9 +882,9 @@ declare var ProgressEvent: { } interface PushManager { - getSubscription(): PromiseLike; - permissionState(options?: PushSubscriptionOptionsInit): PromiseLike; - subscribe(options?: PushSubscriptionOptionsInit): PromiseLike; + getSubscription(): Promise; + permissionState(options?: PushSubscriptionOptionsInit): Promise; + subscribe(options?: PushSubscriptionOptionsInit): Promise; } declare var PushManager: { @@ -897,7 +897,7 @@ interface PushSubscription { readonly options: PushSubscriptionOptions; getKey(name: string): ArrayBuffer | null; toJSON(): any; - unsubscribe(): PromiseLike; + unsubscribe(): Promise; } declare var PushSubscription: { @@ -917,7 +917,7 @@ declare var PushSubscriptionOptions: { interface ReadableStream { readonly locked: boolean; - cancel(): PromiseLike; + cancel(): Promise; getReader(): ReadableStreamReader; } @@ -927,8 +927,8 @@ declare var ReadableStream: { } interface ReadableStreamReader { - cancel(): PromiseLike; - read(): PromiseLike; + cancel(): Promise; + read(): Promise; releaseLock(): void; } @@ -1006,9 +1006,9 @@ interface ServiceWorkerRegistration extends EventTarget { readonly sync: SyncManager; readonly waiting: ServiceWorker | null; getNotifications(filter?: GetNotificationOptions): any; - showNotification(title: string, options?: NotificationOptions): PromiseLike; - unregister(): PromiseLike; - update(): PromiseLike; + showNotification(title: string, options?: NotificationOptions): Promise; + unregister(): Promise; + update(): Promise; addEventListener(type: K, listener: (this: ServiceWorkerRegistration, ev: ServiceWorkerRegistrationEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -1020,7 +1020,7 @@ declare var ServiceWorkerRegistration: { interface SyncManager { getTags(): any; - register(tag: string): PromiseLike; + register(tag: string): Promise; } declare var SyncManager: { @@ -1150,14 +1150,14 @@ interface AbstractWorker { interface Body { readonly bodyUsed: boolean; - arrayBuffer(): PromiseLike; - blob(): PromiseLike; - json(): PromiseLike; - text(): PromiseLike; + arrayBuffer(): Promise; + blob(): Promise; + json(): Promise; + text(): Promise; } interface GlobalFetch { - fetch(input: RequestInfo, init?: RequestInit): PromiseLike; + fetch(input: RequestInfo, init?: RequestInit): Promise; } interface MSBaseReaderEventMap { @@ -1254,10 +1254,10 @@ declare var Client: { } interface Clients { - claim(): PromiseLike; - get(id: string): PromiseLike; + claim(): Promise; + get(id: string): Promise; matchAll(options?: ClientQueryOptions): any; - openWindow(url: USVString): PromiseLike; + openWindow(url: USVString): Promise; } declare var Clients: { @@ -1283,7 +1283,7 @@ declare var DedicatedWorkerGlobalScope: { } interface ExtendableEvent extends Event { - waitUntil(f: PromiseLike): void; + waitUntil(f: Promise): void; } declare var ExtendableEvent: { @@ -1308,7 +1308,7 @@ interface FetchEvent extends ExtendableEvent { readonly clientId: string | null; readonly isReload: boolean; readonly request: Request; - respondWith(r: PromiseLike): void; + respondWith(r: Promise): void; } declare var FetchEvent: { @@ -1383,7 +1383,7 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope { onpushsubscriptionchange: (this: ServiceWorkerGlobalScope, ev: ExtendableEvent) => any; onsync: (this: ServiceWorkerGlobalScope, ev: SyncEvent) => any; readonly registration: ServiceWorkerRegistration; - skipWaiting(): PromiseLike; + skipWaiting(): Promise; addEventListener(type: K, listener: (this: ServiceWorkerGlobalScope, ev: ServiceWorkerGlobalScopeEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -1406,8 +1406,8 @@ declare var SyncEvent: { interface WindowClient extends Client { readonly focused: boolean; readonly visibilityState: string; - focus(): PromiseLike; - navigate(url: USVString): PromiseLike; + focus(): Promise; + navigate(url: USVString): Promise; } declare var WindowClient: { @@ -1735,7 +1735,7 @@ declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number declare function atob(encodedString: string): string; declare function btoa(rawString: string): string; declare var console: Console; -declare function fetch(input: RequestInfo, init?: RequestInit): PromiseLike; +declare function fetch(input: RequestInfo, init?: RequestInit): Promise; declare function dispatchEvent(evt: Event): boolean; declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; declare function addEventListener(type: K, listener: (this: DedicatedWorkerGlobalScope, ev: DedicatedWorkerGlobalScopeEventMap[K]) => any, useCapture?: boolean): void; diff --git a/lib/tsc.js b/lib/tsc.js index 60288a15ae0..aeefb1ad857 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -3025,6 +3025,7 @@ var ts; _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." }, The_operand_of_a_delete_operator_must_be_a_property_reference: { code: 2703, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_must_be_a_property_reference_2703", message: "The operand of a delete operator must be a property reference" }, The_operand_of_a_delete_operator_cannot_be_a_read_only_property: { code: 2704, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_cannot_be_a_read_only_property_2704", message: "The operand of a delete operator cannot be a read-only property" }, + An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option: { code: 2705, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_de_2705", message: "An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -31214,6 +31215,9 @@ var ts; error(func, ts.Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option); return unknownType; } + else if (!getGlobalPromiseConstructorSymbol()) { + error(func, ts.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option); + } return promiseType; } function getReturnTypeFromBody(func, contextualMapper) { @@ -32485,6 +32489,9 @@ var ts; case 148: addName(names, member.name, memberName, 3); break; + case 150: + addName(names, member.name, memberName, 4); + break; } } } @@ -32492,7 +32499,12 @@ var ts; function addName(names, location, name, meaning) { var prev = names.get(name); if (prev) { - if (prev & meaning) { + if (prev & 4) { + if (meaning !== 4) { + error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location)); + } + } + else if (prev & meaning) { error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location)); } else { @@ -33178,7 +33190,12 @@ var ts; var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 107455, true); var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : unknownType; if (promiseConstructorType === unknownType) { - error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName)); + if (promiseConstructorName.kind === 70 && promiseConstructorName.text === "Promise" && getTargetType(returnType) === tryGetGlobalPromiseType()) { + error(node.type, ts.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option); + } + else { + error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName)); + } return unknownType; } var globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType(); @@ -35105,7 +35122,9 @@ var ts; if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); var inAmbientExternalModule = node.parent.kind === 233 && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 263 && !inAmbientExternalModule) { + var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 233 && + !node.moduleSpecifier && ts.isInAmbientContext(node); + if (node.parent.kind !== 263 && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } diff --git a/lib/tsserver.js b/lib/tsserver.js index f987c7edea6..ccdbf835237 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -3035,6 +3035,7 @@ var ts; _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." }, The_operand_of_a_delete_operator_must_be_a_property_reference: { code: 2703, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_must_be_a_property_reference_2703", message: "The operand of a delete operator must be a property reference" }, The_operand_of_a_delete_operator_cannot_be_a_read_only_property: { code: 2704, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_cannot_be_a_read_only_property_2704", message: "The operand of a delete operator cannot be a read-only property" }, + An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option: { code: 2705, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_de_2705", message: "An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -31224,6 +31225,9 @@ var ts; error(func, ts.Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option); return unknownType; } + else if (!getGlobalPromiseConstructorSymbol()) { + error(func, ts.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option); + } return promiseType; } function getReturnTypeFromBody(func, contextualMapper) { @@ -32495,6 +32499,9 @@ var ts; case 148: addName(names, member.name, memberName, 3); break; + case 150: + addName(names, member.name, memberName, 4); + break; } } } @@ -32502,7 +32509,12 @@ var ts; function addName(names, location, name, meaning) { var prev = names.get(name); if (prev) { - if (prev & meaning) { + if (prev & 4) { + if (meaning !== 4) { + error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location)); + } + } + else if (prev & meaning) { error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location)); } else { @@ -33188,7 +33200,12 @@ var ts; var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 107455, true); var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : unknownType; if (promiseConstructorType === unknownType) { - error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName)); + if (promiseConstructorName.kind === 70 && promiseConstructorName.text === "Promise" && getTargetType(returnType) === tryGetGlobalPromiseType()) { + error(node.type, ts.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option); + } + else { + error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName)); + } return unknownType; } var globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType(); @@ -35115,7 +35132,9 @@ var ts; if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); var inAmbientExternalModule = node.parent.kind === 233 && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 263 && !inAmbientExternalModule) { + var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 233 && + !node.moduleSpecifier && ts.isInAmbientContext(node); + if (node.parent.kind !== 263 && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -66217,7 +66236,7 @@ var ts; var span = { start: start, length: end - start }; var newLineChar = ts.getNewLineOrDefaultFromHost(host); var allFixes = []; - ts.forEach(errorCodes, function (error) { + ts.forEach(ts.deduplicate(errorCodes), function (error) { cancellationToken.throwIfCancellationRequested(); var context = { errorCode: error, diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index e297d40ea3a..5444b2ce142 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -3035,6 +3035,7 @@ var ts; _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." }, The_operand_of_a_delete_operator_must_be_a_property_reference: { code: 2703, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_must_be_a_property_reference_2703", message: "The operand of a delete operator must be a property reference" }, The_operand_of_a_delete_operator_cannot_be_a_read_only_property: { code: 2704, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_cannot_be_a_read_only_property_2704", message: "The operand of a delete operator cannot be a read-only property" }, + An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option: { code: 2705, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_de_2705", message: "An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -32348,6 +32349,9 @@ var ts; error(func, ts.Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option); return unknownType; } + else if (!getGlobalPromiseConstructorSymbol()) { + error(func, ts.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option); + } return promiseType; } function getReturnTypeFromBody(func, contextualMapper) { @@ -33619,6 +33623,9 @@ var ts; case 148: addName(names, member.name, memberName, 3); break; + case 150: + addName(names, member.name, memberName, 4); + break; } } } @@ -33626,7 +33633,12 @@ var ts; function addName(names, location, name, meaning) { var prev = names.get(name); if (prev) { - if (prev & meaning) { + if (prev & 4) { + if (meaning !== 4) { + error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location)); + } + } + else if (prev & meaning) { error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location)); } else { @@ -34312,7 +34324,12 @@ var ts; var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 107455, true); var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : unknownType; if (promiseConstructorType === unknownType) { - error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName)); + if (promiseConstructorName.kind === 70 && promiseConstructorName.text === "Promise" && getTargetType(returnType) === tryGetGlobalPromiseType()) { + error(node.type, ts.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option); + } + else { + error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName)); + } return unknownType; } var globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType(); @@ -36239,7 +36256,9 @@ var ts; if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); var inAmbientExternalModule = node.parent.kind === 233 && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 263 && !inAmbientExternalModule) { + var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 233 && + !node.moduleSpecifier && ts.isInAmbientContext(node); + if (node.parent.kind !== 263 && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -66217,7 +66236,7 @@ var ts; var span = { start: start, length: end - start }; var newLineChar = ts.getNewLineOrDefaultFromHost(host); var allFixes = []; - ts.forEach(errorCodes, function (error) { + ts.forEach(ts.deduplicate(errorCodes), function (error) { cancellationToken.throwIfCancellationRequested(); var context = { errorCode: error, diff --git a/lib/typescript.js b/lib/typescript.js index c6df692fb3a..81a8016c416 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -4471,6 +4471,7 @@ var ts; _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." }, The_operand_of_a_delete_operator_must_be_a_property_reference: { code: 2703, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_must_be_a_property_reference_2703", message: "The operand of a delete operator must be a property reference" }, The_operand_of_a_delete_operator_cannot_be_a_read_only_property: { code: 2704, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_cannot_be_a_read_only_property_2704", message: "The operand of a delete operator cannot be a read-only property" }, + An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option: { code: 2705, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_de_2705", message: "An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -37815,6 +37816,9 @@ var ts; error(func, ts.Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option); return unknownType; } + else if (!getGlobalPromiseConstructorSymbol()) { + error(func, ts.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option); + } return promiseType; } function getReturnTypeFromBody(func, contextualMapper) { @@ -39239,12 +39243,13 @@ var ts; } } function checkClassForDuplicateDeclarations(node) { - var Accessor; - (function (Accessor) { - Accessor[Accessor["Getter"] = 1] = "Getter"; - Accessor[Accessor["Setter"] = 2] = "Setter"; - Accessor[Accessor["Property"] = 3] = "Property"; - })(Accessor || (Accessor = {})); + var Declaration; + (function (Declaration) { + Declaration[Declaration["Getter"] = 1] = "Getter"; + Declaration[Declaration["Setter"] = 2] = "Setter"; + Declaration[Declaration["Method"] = 4] = "Method"; + Declaration[Declaration["Property"] = 3] = "Property"; + })(Declaration || (Declaration = {})); var instanceNames = ts.createMap(); var staticNames = ts.createMap(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { @@ -39272,6 +39277,9 @@ var ts; case 148 /* PropertyDeclaration */: addName(names, member.name, memberName, 3 /* Property */); break; + case 150 /* MethodDeclaration */: + addName(names, member.name, memberName, 4 /* Method */); + break; } } } @@ -39279,7 +39287,12 @@ var ts; function addName(names, location, name, meaning) { var prev = names.get(name); if (prev) { - if (prev & meaning) { + if (prev & 4 /* Method */) { + if (meaning !== 4 /* Method */) { + error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location)); + } + } + else if (prev & meaning) { error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location)); } else { @@ -40161,7 +40174,12 @@ var ts; var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 107455 /* Value */, /*ignoreErrors*/ true); var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : unknownType; if (promiseConstructorType === unknownType) { - error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName)); + if (promiseConstructorName.kind === 70 /* Identifier */ && promiseConstructorName.text === "Promise" && getTargetType(returnType) === tryGetGlobalPromiseType()) { + error(node.type, ts.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option); + } + else { + error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName)); + } return unknownType; } var globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType(); @@ -42447,7 +42465,9 @@ var ts; // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); var inAmbientExternalModule = node.parent.kind === 233 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 263 /* SourceFile */ && !inAmbientExternalModule) { + var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 233 /* ModuleBlock */ && + !node.moduleSpecifier && ts.isInAmbientContext(node); + if (node.parent.kind !== 263 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -81490,7 +81510,7 @@ var ts; var span = { start: start, length: end - start }; var newLineChar = ts.getNewLineOrDefaultFromHost(host); var allFixes = []; - ts.forEach(errorCodes, function (error) { + ts.forEach(ts.deduplicate(errorCodes), function (error) { cancellationToken.throwIfCancellationRequested(); var context = { errorCode: error, diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index c6df692fb3a..81a8016c416 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -4471,6 +4471,7 @@ var ts; _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." }, The_operand_of_a_delete_operator_must_be_a_property_reference: { code: 2703, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_must_be_a_property_reference_2703", message: "The operand of a delete operator must be a property reference" }, The_operand_of_a_delete_operator_cannot_be_a_read_only_property: { code: 2704, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_cannot_be_a_read_only_property_2704", message: "The operand of a delete operator cannot be a read-only property" }, + An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option: { code: 2705, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_de_2705", message: "An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -37815,6 +37816,9 @@ var ts; error(func, ts.Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option); return unknownType; } + else if (!getGlobalPromiseConstructorSymbol()) { + error(func, ts.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option); + } return promiseType; } function getReturnTypeFromBody(func, contextualMapper) { @@ -39239,12 +39243,13 @@ var ts; } } function checkClassForDuplicateDeclarations(node) { - var Accessor; - (function (Accessor) { - Accessor[Accessor["Getter"] = 1] = "Getter"; - Accessor[Accessor["Setter"] = 2] = "Setter"; - Accessor[Accessor["Property"] = 3] = "Property"; - })(Accessor || (Accessor = {})); + var Declaration; + (function (Declaration) { + Declaration[Declaration["Getter"] = 1] = "Getter"; + Declaration[Declaration["Setter"] = 2] = "Setter"; + Declaration[Declaration["Method"] = 4] = "Method"; + Declaration[Declaration["Property"] = 3] = "Property"; + })(Declaration || (Declaration = {})); var instanceNames = ts.createMap(); var staticNames = ts.createMap(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { @@ -39272,6 +39277,9 @@ var ts; case 148 /* PropertyDeclaration */: addName(names, member.name, memberName, 3 /* Property */); break; + case 150 /* MethodDeclaration */: + addName(names, member.name, memberName, 4 /* Method */); + break; } } } @@ -39279,7 +39287,12 @@ var ts; function addName(names, location, name, meaning) { var prev = names.get(name); if (prev) { - if (prev & meaning) { + if (prev & 4 /* Method */) { + if (meaning !== 4 /* Method */) { + error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location)); + } + } + else if (prev & meaning) { error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location)); } else { @@ -40161,7 +40174,12 @@ var ts; var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 107455 /* Value */, /*ignoreErrors*/ true); var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : unknownType; if (promiseConstructorType === unknownType) { - error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName)); + if (promiseConstructorName.kind === 70 /* Identifier */ && promiseConstructorName.text === "Promise" && getTargetType(returnType) === tryGetGlobalPromiseType()) { + error(node.type, ts.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option); + } + else { + error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName)); + } return unknownType; } var globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType(); @@ -42447,7 +42465,9 @@ var ts; // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); var inAmbientExternalModule = node.parent.kind === 233 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 263 /* SourceFile */ && !inAmbientExternalModule) { + var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 233 /* ModuleBlock */ && + !node.moduleSpecifier && ts.isInAmbientContext(node); + if (node.parent.kind !== 263 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -81490,7 +81510,7 @@ var ts; var span = { start: start, length: end - start }; var newLineChar = ts.getNewLineOrDefaultFromHost(host); var allFixes = []; - ts.forEach(errorCodes, function (error) { + ts.forEach(ts.deduplicate(errorCodes), function (error) { cancellationToken.throwIfCancellationRequested(); var context = { errorCode: error, diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js index 78fd2fa2a6a..cb9d2334266 100644 --- a/lib/typingsInstaller.js +++ b/lib/typingsInstaller.js @@ -3035,6 +3035,7 @@ var ts; _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." }, The_operand_of_a_delete_operator_must_be_a_property_reference: { code: 2703, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_must_be_a_property_reference_2703", message: "The operand of a delete operator must be a property reference" }, The_operand_of_a_delete_operator_cannot_be_a_read_only_property: { code: 2704, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_cannot_be_a_read_only_property_2704", message: "The operand of a delete operator cannot be a read-only property" }, + An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option: { code: 2705, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_de_2705", message: "An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },