massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-tsserver / node_modules / typescript / lib / lib.es2015.promise.d.ts
1 /*! *****************************************************************************
2 Copyright (c) Microsoft Corporation. All rights reserved.
3 Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4 this file except in compliance with the License. You may obtain a copy of the
5 License at http://www.apache.org/licenses/LICENSE-2.0
6
7 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8 KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9 WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 MERCHANTABLITY OR NON-INFRINGEMENT.
11
12 See the Apache Version 2.0 License for specific language governing permissions
13 and limitations under the License.
14 ***************************************************************************** */
15
16
17
18 /// <reference no-default-lib="true"/>\r
19
20
21 interface PromiseConstructor {\r
22     /**\r
23      * A reference to the prototype.\r
24      */\r
25     readonly prototype: Promise<any>;\r
26 \r
27     /**\r
28      * Creates a new Promise.\r
29      * @param executor A callback used to initialize the promise. This callback is passed two arguments:\r
30      * a resolve callback used to resolve the promise with a value or the result of another promise,\r
31      * and a reject callback used to reject the promise with a provided reason or error.\r
32      */\r
33     new <T>(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;\r
34 \r
35     /**\r
36      * Creates a Promise that is resolved with an array of results when all of the provided Promises\r
37      * resolve, or rejected when any Promise is rejected.\r
38      * @param values An array of Promises.\r
39      * @returns A new Promise.\r
40      */\r
41     all<T extends readonly unknown[] | []>(values: T): Promise<{ -readonly [P in keyof T]: Awaited<T[P]> }>;\r
42 \r
43     // see: lib.es2015.iterable.d.ts\r
44     // all<T>(values: Iterable<T | PromiseLike<T>>): Promise<T[]>;\r
45 \r
46     /**\r
47      * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved\r
48      * or rejected.\r
49      * @param values An array of Promises.\r
50      * @returns A new Promise.\r
51      */\r
52     race<T extends readonly unknown[] | []>(values: T): Promise<Awaited<T[number]>>;\r
53 \r
54     // see: lib.es2015.iterable.d.ts\r
55     // race<T>(values: Iterable<T>): Promise<T extends PromiseLike<infer U> ? U : T>;\r
56 \r
57     /**\r
58      * Creates a new rejected promise for the provided reason.\r
59      * @param reason The reason the promise was rejected.\r
60      * @returns A new rejected Promise.\r
61      */\r
62     reject<T = never>(reason?: any): Promise<T>;\r
63 \r
64     /**\r
65      * Creates a new resolved promise.\r
66      * @returns A resolved promise.\r
67      */\r
68     resolve(): Promise<void>;\r
69 \r
70     /**\r
71      * Creates a new resolved promise for the provided value.\r
72      * @param value A promise.\r
73      * @returns A promise whose internal state matches the provided promise.\r
74      */\r
75     resolve<T>(value: T | PromiseLike<T>): Promise<T>;\r
76 }\r
77 \r
78 declare var Promise: PromiseConstructor;\r