File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -14,4 +14,18 @@ interface PromiseConstructor {
14
14
* ```
15
15
*/
16
16
withResolvers < T > ( ) : PromiseWithResolvers < T > ;
17
+
18
+ /**
19
+ * Takes a callback of any kind (returns or throws, synchronously or asynchronously) and wraps its result
20
+ * in a Promise.
21
+ *
22
+ * @param callbackFn A function that is called synchronously with no arguments. It can do anything: either return
23
+ * a value, throw an error, or return a promise.
24
+ *
25
+ * @returns A Promise that is:
26
+ * - Already fulfilled, if callbackFn synchronously returns a value.
27
+ * - Already rejected, if callbackFn synchronously throws an error.
28
+ * - Asynchronously fulfilled or rejected, if callbackFn returns a promise.
29
+ */
30
+ try < T > ( callbackFn : ( ) => T | Promise < T > ) : Promise < T > ;
17
31
}
You can’t perform that action at this time.
0 commit comments