'target in tsconfig.json setting not working but command works?

{
  "compilerOptions": {
    "target": "es5"
  }
}

I have tsconfig.json as above, and when I run command tsc app.ts --watch, I hit error

Accessors are only available when targeting ECMAScript 5 and higher

If I explicitly set the target in my command, it works

tsc -t es5 app.ts --watch

Any lead to which part may have gone wrong, why the discrepancy between two outcomes?

UPDATES

enter image description here



Solution 1:[1]

it might not work for everyone else but running tsc index.ts --watch worked for me. You can try this out.

Solution 2:[2]

Documentation says

When input files are specified on the command line, tsconfig.json files are ignored.

That's why when you run tsc app.ts --watch, your tsconfig.json file isn't being applied. You're providing app.ts.

Solution 3:[3]

Make sure you have restarted your typescript server, it worked for me.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ashraful
Solution 2 brainzerg
Solution 3 Luann Sapucaia