javascript - Get AsyncFunction constructor in Typescript -


so i'm trying dynamically create asyncfunctions in typescript program. mdn says can asyncfunction constructor

var asyncfunction = object.getprototypeof(async function () { }).constructor; 

but typescript compiles to

var asyncfunction = object.getprototypeof(function () {     return __awaiter(this, void 0, void 0, function* () { }); }).constructor; 

the difference can seen attempting use constructor;

new asyncfunction("return 1;")(); 

returns promise (what need) when run in firefox, returns 1when run after being passed through typescript.

how can stop typescript mangling async functions?


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -