如何使用SystemJS和Angular使用Typescript?

poc*_*sar 9 commonjs angularjs typescript systemjs

我正在努力使SystemJS与Typescript一起工作,但它们似乎相互冲突.

如何在没有与Typescript上的关键字冲突的情况下利用System.js中的自动加载?使用import/require使得Typescript使用它自己的方式来加载和引用文件,虽然它翻译exportmodule.exports = ...,但它不会做同样的事情import

是否有可能实现这一点,或者我将不得不等待Typescript支持ES6关键字?

Mic*_*ltu 6

TypeScript 1.5增加了对编译ES5 SystemJS模块语法的支持.

创作一个类:

export class Foo {}
Run Code Online (Sandbox Code Playgroud)

然后编译

tsc --module system foo.ts
Run Code Online (Sandbox Code Playgroud)

结果将是使用SystemJS格式的ES5模块.