Seems like tsc uses invalid class name when targeting ES6 and CommonJS, at least with custom promises in async functions.
// Task.ts
export class Task<T> extends Promise<T> {}
// Test.ts
import { Task } from "./Task";
class Test
{
async Example<T>(): Task<T> {}
}
compiled to
// Task.js
class Task extends Promise {}
exports.Task = Task;
// Test.js
var __awaiter = ...
var Task_1 = require("./Task");
class Test
{
Example() { return __awaiter(this, void 0, Task, function* () {}); }
}
Instead of return __awaiter(this, void 0, Task, function* () {}); should be return __awaiter(this, void 0, Task_1.Task, function* () {}); since Task is imported as Task_1.Task when using commonjs.
1.8.0-dev.20151125
tsc --target es6 --module commonjs
Seems like tsc uses invalid class name when targeting ES6 and CommonJS, at least with custom promises in async functions.
compiled to
Instead of
return __awaiter(this, void 0, Task, function* () {});should bereturn __awaiter(this, void 0, Task_1.Task, function* () {});sinceTaskis imported asTask_1.Taskwhen using commonjs.1.8.0-dev.20151125
tsc --target es6 --module commonjs