Recently I have tried Deno and since it has native TypeScript support, I thought it would be neat to use it as a "typescript runner". For example in Node you would write node server.js
and in Deno would be like deno run -A server.ts
and all of this in the code runner extension.
In vscode settings.json :
"code-runner.executorMap": {
"javascript": "node",
"typescript": "cd $dir && deno run -A $fileName"
}
Consider the following ts file "index.ts" :
const add = (a: number,b: number):number =>{
console.log(a+b);
return a+b;
}
add(1,2);
Output when running using the extension :
[Running] deno run -A index.ts
[33m3[39m
[Done] exited with code=0 in 0.082 seconds
Output when using the terminal cmd/powershell :
C:\Users\Oliver\Desktop\DenoPJ>deno run -A index.ts
3
Any thoughts about why it works inside the terminal and not inside the extension ?
I tried and could reproduce the problem.
When you change the settings under "Run Code configuration" to "Run in Terminal"
and then run the code again with AltCtrlN, VSCode will switch to the Terminal window and you should see: