When I try to compile the below TypeScript using "tsc file.ts," I get the following error (twice):
error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
According to this article on StackOverflow - Accessors are only available when targeting ECMAScript 5 and higher -- I should be able to specify a "tsconfig.json" file, which I've done:
{
  "compilerOptions": {
    "target": "ES5"
  }
}
export class CPoint {
  constructor(private _x?: number, private _y?: number) {
  };
  public draw() { 
    console.log(`x: ${this._x} y: ${this._y}`);
  }
  public get x() {
    return this._x;
  }
  public set x(value: number) {
    if (value < 0) {
      throw new Error('The value cannot be less than 0.');
    }
    this._x = value;
  }
}
I can compile using --target "ES5" but why doesn't tsc read my .json file? I don't want to have to specify ES5 on every compile.
 
     
     
    