I am trying to configure vscode to compile typescript by looking in to this question Visual Studio Code: compile typescript module and this article https://cmatskas.com/typescript-and-vs-code/ but getting an error. Need help.
My project tree:
The file server.ts
it is what I want to compile but later I will have more .ts
files.
Here is my tasks.json
{
"version": "0.1.0",
// The command is tsc. Assumes that tsc has been installed using npm install -g typescript
"command": "tsc",
// The command is a shell script
"isShellCommand": true,
// Show the output window only if unrecognized errors occur.
"showOutput": "always",
"windows": {
"command": "tsc"
},
// args is the HelloWorld program to compile.
"args": ["-p", "."],
// use the standard tsc problem matcher to find compile problems
// in the output.
"problemMatcher": "$tsc"
}
and my tsconfig.json
{
"compilerOptions": {
"target": "ES5",
"module": "commonjs",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"sourceRoot": "/"
},
"exclude": [
"node_modules"
]
}
my tsc version
: message TS6029: Version 1.7.5
Detailed error:
C:\Users\User\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:31084
var jsonOptions = json["compilerOptions"];
^
TypeError: Cannot read property 'compilerOptions' of undefined
at getCompilerOptions (C:\Users\User\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:31084:35)
at Object.parseJsonConfigFileContent (C:\Users\User\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:31074:22)
at parseConfigFile (C:\Users\User\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:31351:40)
at performCompilation (C:\Users\User\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:31362:45)
at Object.executeCommandLine (C:\Users\User\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:31336:9)
at Object.<anonymous> (C:\Users\User\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:31635:4)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)