fix: await in async func throws properly

This commit is contained in:
2023-08-25 17:00:47 +03:00
parent 396d7ca5a2
commit 991f957f44
8 changed files with 76 additions and 31 deletions

View File

@@ -297,6 +297,14 @@ setProps(Array.prototype, {
return -1;
},
lastIndexOf(el, start) {
start = start! | 0;
for (var i = this.length; i >= start; i--) {
if (i in this && this[i] == el) return i;
}
return -1;
},
includes(el, start) {
return this.indexOf(el, start) >= 0;
},

View File

@@ -14,7 +14,7 @@ interface FunctionConstructor extends Function {
(...args: string[]): (...args: any[]) => any;
new (...args: string[]): (...args: any[]) => any;
prototype: Function;
async<ArgsT extends any[], RetT>(func: (await: <T>(val: T) => Awaited<T>, args: ArgsT) => RetT): Promise<RetT>;
async<ArgsT extends any[], RetT>(func: (await: <T>(val: T) => Awaited<T>) => (...args: ArgsT) => RetT): (...args: ArgsT) => Promise<RetT>;
}
interface CallableFunction extends Function {