-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
tsc 1.6.2 with -t es6 --experimentalAsyncFunctions.
declare namespace ns {
export type PromiseAlias = Promise<any>;
}
async function f(): ns.PromiseAlias {
return new Promise((resolve) => {
resolve();
});
}
f();converts to the bellow.
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, ns.PromiseAlias, function* () {
return new Promise((resolve) => {
resolve();
});
});
}
f();throw this error.
return __awaiter(this, void 0, ns.PromiseAlias, function* () {
^
ReferenceError: ns is not defined
ns.PromiseAlias is an alias, doesn't have an implementation. Is this correct? thanks.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue