如何在TypeScript中使用systemjs导入和导出模块?

时间:2016-02-04 21:45:03

标签: typescript systemjs

有没有人知道如何在TypeScript中使用systemjs导出模块?我收到了错误:1/3

这是我的代码; animal.ts

TS1148 cannot compile modules unless the '--module' flag is provided

dog.ts

export class Animal {
    color: string;
    age: number;

    constructor(color: string, age:number) {
        this.color = color;
        this.age = age;
    }

    add(animal: Animal) {
        return new Animal(this.color + animal.color, this.age + animal.age);
    }
}

1 个答案:

答案 0 :(得分:0)

您可以在系统配置中指定typescript编译器选项。可以找到许多选项here

System.config({
    typescriptOptions:{
        module: 'system'
    }
});
相关问题