除非提供'--module'标志,否则无法编译外部模块

Pra*_*Dey 9 typescript1.5 visual-studio-code angular

使用带有angularjs2和Typescript 1.5beta的visual studio代码时出现问题.

错误:(3,1)TS1148:除非提供了"--module"标志,否则无法编译外部模块.
错误:(6,1)TS1205:装饰器仅在定位ECMAScript 5及更高版本时可用.

我可以使用命令行编译器使用tsc -t es5 -m commonjs app.ts运行相同的代码.同样的问题也出现在webstorm 10.0.2中.

小智 11

这就是我在Webstorm/IntelliJ中解决它的方法

文件>设置>语言和框架> TypeScript

命令行选项:

-m amd -t ES5


Pra*_*Dey 6

我自己在视觉工作室代码上解决了 脚步:

1)tsd init

2)tsd查询angular --action install --save

3)创建tsconfig.json.配置文件看起来像这样

{ "compilerOptions": { "target": "ES5", "module": "commonjs", "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "removeComments": false, "noImplicitAny": false } }

但仍然不知道如何使它在webstorm上工作

  • 有关`tsconfig.json`的更多信息,请参阅https://github.com/Microsoft/TypeScript/wiki/tsconfig.json (2认同)