mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
fix(60223): add Promise.try() to ESNext lib (#60232)
This commit is contained in:
@@ -247,6 +247,7 @@ const libEntries: [string, string][] = [
|
||||
["esnext.regexp", "lib.es2024.regexp.d.ts"],
|
||||
["esnext.string", "lib.es2024.string.d.ts"],
|
||||
["esnext.iterator", "lib.esnext.iterator.d.ts"],
|
||||
["esnext.promise", "lib.esnext.promise.d.ts"],
|
||||
["decorators", "lib.decorators.d.ts"],
|
||||
["decorators.legacy", "lib.decorators.legacy.d.ts"],
|
||||
];
|
||||
|
||||
Vendored
+1
@@ -5,3 +5,4 @@
|
||||
/// <reference lib="esnext.collection" />
|
||||
/// <reference lib="esnext.array" />
|
||||
/// <reference lib="esnext.iterator" />
|
||||
/// <reference lib="esnext.promise" />
|
||||
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
interface PromiseConstructor {
|
||||
/**
|
||||
* Takes a callback of any kind (returns or throws, synchronously or asynchronously) and wraps its result
|
||||
* in a Promise.
|
||||
*
|
||||
* @param callbackFn A function that is called synchronously. It can do anything: either return
|
||||
* a value, throw an error, or return a promise.
|
||||
* @param args Additional arguments, that will be passed to the callback.
|
||||
*
|
||||
* @returns A Promise that is:
|
||||
* - Already fulfilled, if the callback synchronously returns a value.
|
||||
* - Already rejected, if the callback synchronously throws an error.
|
||||
* - Asynchronously fulfilled or rejected, if the callback returns a promise.
|
||||
*/
|
||||
try<T, U extends unknown[]>(callbackFn: (...args: U) => T | PromiseLike<T>, ...args: U): Promise<Awaited<T>>;
|
||||
}
|
||||
@@ -85,6 +85,7 @@
|
||||
"esnext.collection",
|
||||
"esnext.array",
|
||||
"esnext.iterator",
|
||||
"esnext.promise",
|
||||
"decorators",
|
||||
"decorators.legacy",
|
||||
// Default libraries
|
||||
|
||||
Reference in New Issue
Block a user