0

I am trying to launch .ts file as console app. After converting .ts files to .js (through tsc) there was no error, but I can't launch .ts file with ts-node because of issue:

"SyntaxError: Unexpected token ..."

My tsconfig.json file is

{
"compilerOptions": {
    "target": "es6",
    "module": "commonjs",
    "strict": true,
    "esModuleInterpop": rue
    }
} 

Typescript code is

constructor(... pieces : IPiece[]){
super();
for (let i = 0; i < pieces.length; i++) {
    this.add(pieces[i]);
}}

So I guess that tsc and ts-node compile .ts files differently. Any ideas? Thanks.

AS Mackay
  • 2,831
  • 9
  • 19
  • 25
seri
  • 3
  • 1
  • 2

1 Answers1

0

your tsconfig.json file code something spell mistake,

{
"compilerOptions": {
    "target": "es6",
    "module": "commonjs",
    "strict": true,
    "esModuleInterpop": rue // here change to true.
    }
} 

Edit:-

... pieces : IPiece[]

remove and add private or public type to this one.

constructor(public pieces : IPiece[]){ } //use public or private

let try this once and let me know.

Karnan Muthukumar
  • 1,843
  • 1
  • 8
  • 15