0

I am using tsc -w to compile my project. I've been using it for quite a long time now but it recently stopped working after a small refactoring for (really) no reason. When I run the command, it shows me instead tsc --help. I didn't touch the tsconfig.json which is still :

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": true,
    "suppressImplicitAnyIndexErrors": true
  }
}

Did it happenned to anyone before? How can I resolve it? Thanks.

Takichiii
  • 453
  • 4
  • 14
  • 27

2 Answers2

0

It may be that you are using a deprecated flag.

It is worth reviewing the listed options to see if you are using one that isn't listed, for example if you have:

"emitDecoratorMetadata": true,

But the help shows:

...
--allowUnusedLabels                 Do not report errors on unused labels.
-d, --declaration                   Generates corresponding '.d.ts' file.
--experimentalDecorators            Enables experimental support for ES7 decorators.
--forceConsistentCasingInFileNames  Disallow inconsistently-cased references to the same file.
...

In this case, (because it is alphabetical) I can see emitDecoratorMetadata is not there and removing it should make things work.

Note: this solution should work for any case where a previously working tsc command stops working.

Fenton
  • 241,084
  • 71
  • 387
  • 401
  • This solution didn't work for me but I tought it can help someone else. I actually resolved the problem by executing the command in the folder where `tsconfig.json` is, but I I would like to emphasize the fact that I didn't change anything and it worked perfectly fine before. I noticed there are a lot of "weird" bugs like this with the tsc – Takichiii Aug 11 '16 at 08:40
0

Just change

"target": "es5",

to

"target": "es6",

That works for me.

user247702
  • 23,641
  • 15
  • 110
  • 157
Radosvet Petrov
  • 748
  • 6
  • 9