Viktor Danilov Viktor Danilov - 1 year ago 191
TypeScript Question

Angular 2: how to provide `--module system --experimentalDecorators` flags?

I'm having a trouble with compilling my TypeScript file:


import {Component} from 'angular2/core';

selector: 'my-app',
template: '<h1>Messenger</h1>'
export class AppComponent { }

TypeScript Compiller returns

Error:(1, 1) TS1148: Cannot compile modules unless the '--module' flag is provided.
Error:(1, 25) TS2307: Cannot find module 'angular2/core'.
Error:(7, 14) TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning.

Providing flags in tsconfig.json does nothing.


"compilerOptions": {
"target": "es5",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
"exclude": [

My project tree:

├── app
├── node_modules
├── typings
├── application.js
├── messages.js
├── package.json
├── tsconfig.json
└── typings.json

I'm using RubyMine 8 as IDE

What am I doing wrong? Is there another way to provide my flags?

x0x x0x
Answer Source

If you are using the bundled TypeScript compiler, go to File > Settings > Languages & Frameworks > TypeScript

You can click on the set options manually radio button, and enter the arguments in the Command line options text box. See the list of available arguments

webstorm typescript configuration

This is how you provide command line arguments.

Use tsconfig.json works for me without providing any command line arguments.