@@ -829,23 +829,106 @@ Index: es5.d.ts
829829
830830 declare var Array: ArrayConstructor;
831831
832- @@ -1737,9 +1776,15 @@
832+ @@ -1737,9 +1776,11 @@
833833 }
834834
835835 declare type PromiseConstructorLike = new <T>(
836836 executor: (
837837- resolve: (value: T | PromiseLike<T>) => void,
838838+ resolve: undefined extends T
839- + ? {
840- + (value?: T | PromiseLike<T>): void;
841- + }
842- + : {
843- + (value: T | PromiseLike<T>): void;
844- + },
839+ + ? (value?: T | PromiseLike<T>) => void
840+ + : (value: T | PromiseLike<T>) => void,
845841 reject: (reason?: any) => void
846842 ) => void
847843 ) => PromiseLike<T>;
848844
845+ @@ -1749,52 +1790,56 @@
846+ * @param onfulfilled The callback to execute when the Promise is resolved.
847+ * @param onrejected The callback to execute when the Promise is rejected.
848+ * @returns A Promise for the completion of which ever callback is executed.
849+ */
850+ - then<TResult1 = T, TResult2 = never>(
851+ - onfulfilled?:
852+ - | ((value: T) => TResult1 | PromiseLike<TResult1>)
853+ - | undefined
854+ - | null,
855+ - onrejected?:
856+ - | ((reason: any) => TResult2 | PromiseLike<TResult2>)
857+ - | undefined
858+ - | null
859+ - ): PromiseLike<TResult1 | TResult2>;
860+ + then(
861+ + onfulfilled?: null | undefined,
862+ + onrejected?: ((reason: unknown) => T | PromiseLike<T>) | null | undefined
863+ + ): PromiseLike<T>;
864+ +
865+ + /**
866+ + * Attaches callbacks for the resolution and/or rejection of the Promise.
867+ + * @param onfulfilled The callback to execute when the Promise is resolved.
868+ + * @param onrejected The callback to execute when the Promise is rejected.
869+ + * @returns A Promise for the completion of which ever callback is executed.
870+ + */
871+ + then<U>(
872+ + onfulfilled: (value: T) => U | PromiseLike<U>,
873+ + onrejected?: ((reason: unknown) => U | PromiseLike<U>) | null | undefined
874+ + ): PromiseLike<U>;
875+ }
876+
877+ - /**
878+ - * Represents the completion of an asynchronous operation
879+ - */
880+ - interface Promise<T> {
881+ + interface Promise<T> extends PromiseLike<T> {
882+ /**
883+ * Attaches callbacks for the resolution and/or rejection of the Promise.
884+ * @param onfulfilled The callback to execute when the Promise is resolved.
885+ * @param onrejected The callback to execute when the Promise is rejected.
886+ * @returns A Promise for the completion of which ever callback is executed.
887+ */
888+ - then<TResult1 = T, TResult2 = never>(
889+ - onfulfilled?:
890+ - | ((value: T) => TResult1 | PromiseLike<TResult1>)
891+ - | undefined
892+ - | null,
893+ - onrejected?:
894+ - | ((reason: any) => TResult2 | PromiseLike<TResult2>)
895+ - | undefined
896+ - | null
897+ - ): Promise<TResult1 | TResult2>;
898+ + then(
899+ + onfulfilled?: null | undefined,
900+ + onrejected?: ((reason: unknown) => T | PromiseLike<T>) | null | undefined
901+ + ): Promise<T>;
902+
903+ /**
904+ + * Attaches callbacks for the resolution and/or rejection of the Promise.
905+ + * @param onfulfilled The callback to execute when the Promise is resolved.
906+ + * @param onrejected The callback to execute when the Promise is rejected.
907+ + * @returns A Promise for the completion of which ever callback is executed.
908+ + */
909+ + then<U>(
910+ + onfulfilled: (value: T) => U | PromiseLike<U>,
911+ + onrejected?: ((reason: unknown) => U | PromiseLike<U>) | null | undefined
912+ + ): Promise<U>;
913+ +
914+ + /**
915+ * Attaches a callback for only the rejection of the Promise.
916+ * @param onrejected The callback to execute when the Promise is rejected.
917+ * @returns A Promise for the completion of the callback.
918+ */
919+ - catch<TResult = never>(
920+ - onrejected?:
921+ - | ((reason: any) => TResult | PromiseLike<TResult>)
922+ - | undefined
923+ - | null
924+ - ): Promise<T | TResult>;
925+ + catch(
926+ + onrejected?: ((reason: unknown) => T | PromiseLike<T>) | null | undefined
927+ + ): Promise<T>;
928+ }
929+
930+ /**
931+ * Recursively unwraps the "awaited type" of a type. Non-promise "thenables" should resolve to `never`. This emulates the behavior of `await`.
849932@@ -2144,20 +2189,24 @@
850933 * is treated as length+end.
851934 * @param end If not specified, length of the this object is used as its default value.
0 commit comments