Below is source and getting SyntaxError: Unexpected token :at createScript (vm.js:80:10) .
class Greeter {
greeting: string;
constructor(message: string) {
this.greeting = message;
}
greet() {
return "Hello, " + this.greeting;
}
}
let greeter = new Greeter("world");
Please help to find complete error trace .
PS D:\my-app\ts-hello> node .\Greeter.ts
D:\my-app\ts-hello\Greeter.ts:2
greeting: string;
^
SyntaxError: Unexpected token :
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3
PS D:\my-app\ts-hello>
PS D:\my-app\ts-hello>