windows - vscode typescript Cannot read property 'compilerOptions' of undefined -


i trying configure vscode compile typescript looking in question visual studio code: compile typescript module , article https://cmatskas.com/typescript-and-vs-code/ getting error. need help.

my project tree:

enter image description here

the file server.ts want compile later have more .ts files.

here tasks.json

{     "version": "0.1.0",      // command tsc. assumes tsc has been installed using npm install -g typescript     "command": "tsc",      // command shell script     "isshellcommand": true,      // show output window if unrecognized errors occur.     "showoutput": "always",      "windows": {         "command": "tsc"     },      // args helloworld program compile.     "args": ["-p", "."],      // use standard tsc problem matcher find compile problems     // in output.     "problemmatcher": "$tsc" } 

and 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 @ getcompileroptions (c:\users\user\appdata\roaming\npm\node_modules\typescript\lib\tsc.js:31084:35) @ object.parsejsonconfigfilecontent (c:\users\user\appdata\roaming\npm\node_modules\typescript\lib\tsc.js:31074:22) @ parseconfigfile (c:\users\user\appdata\roaming\npm\node_modules\typescript\lib\tsc.js:31351:40) @ performcompilation (c:\users\user\appdata\roaming\npm\node_modules\typescript\lib\tsc.js:31362:45) @ object.executecommandline (c:\users\user\appdata\roaming\npm\node_modules\typescript\lib\tsc.js:31336:9) @ object.<anonymous> (c:\users\user\appdata\roaming\npm\node_modules\typescript\lib\tsc.js:31635:4) @ module._compile (module.js:435:26) @ object.module._extensions..js (module.js:442:10) @ module.load (module.js:356:32) @ function.module._load (module.js:311:12)

when visual studio code runs typescript compiler, runs relative root folder tsconfig.json in ./server folder. why compiler not able locate tsconfig.json file in root. need in tasks.json, need update args parameter below, assuming entire project in server folder. i.e don't have .ts files in client folder needs compiled typescript compiler.

// args helloworld program compile. "args": ["-p", "./server"], 

if client folder has ts files needs compiled, need move tsconfig.json root folder , typescript compiler able find it.


Comments