Last active
July 20, 2022 11:57
-
-
Save rbuckton/aa4ab629a8b0b97ee428 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) { | |
return new Promise(function (resolve, reject) { | |
generator = generator.call(thisArg, _arguments); | |
function cast(value) { return value instanceof Promise && value.constructor === Promise ? value | |
: new Promise(function (resolve) { resolve(value); }); } | |
function onfulfill(value) { try { step("next", value); } catch (e) { reject(e); } } | |
function onreject(value) { try { step("throw", value); } catch (e) { reject(e); } } | |
function step(verb, value) { | |
var result = generator[verb](value); | |
result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject); | |
} | |
step("next", void 0); | |
}); | |
}; | |
function F() { | |
return __awaiter(this, void 0, Promise, function* () { | |
yield someAsync(); | |
return 1; | |
}); | |
} | |
function G() { | |
return __awaiter(this, void 0, MyPromise, function* () { | |
yield someAsync(); | |
return 1; | |
}); | |
} | |
function H(x) { | |
var f = () => __awaiter(this, arguments, Promise, function* (_arguments) { yield _arguments[0]; }); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare function someAsync(): Promise<string>; | |
async function F() { // Promise<number> | |
await someAsync(); // string | |
return 1; | |
} | |
async function G(): MyPromise<number> { | |
await someAsync(); // string | |
return 1; | |
} | |
function H(x: Promise<number>) { | |
let f = async () => await arguments[0]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To clarify the two key differences between this and the previous design are:
Correct?