I am trying to use the "Run Build Task" command in Visual Studio Code on Windows 10 to compile TypeScript with Git Bash, but I get this error:
It seems that the backslashes are being interpreted as escape characters, so they disappear.
This issue does not happen when I switch the default shell to Powershell or cmd.exe. Also, the same issue happens no matter if I install TypeScript globally (npm i -g typescript
) or locally (npm i typescript
). Finally, I suspect that my %PATH%
environment variable may need fixing as well.
This is the tsconfig.json
file I have been using:
{
"compileOnSave": true,
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"sourceMap": true
}
}
My end goal is to simply press Ctrl+S
on a TypeScript code file and have it immediately transpile to JavaScript (given the TS file is valid, of course.)