I am facing an issue while debugging a TypeScript file in VSCode. When I try to launch it, instead of calling TypeScript on the file first, VSCode launches "node CheckFMBackup.ts" before "node CheckFMBackup.js". Can someone explain why this is happening? Could it be a misconfiguration on my end?
The reason I suspect node is being called instead of TypeScript is evident in the screenshot provided below. Breakpoints have been enabled for checked and unchecked exceptions.
Here is a snippet from CheckFMBackup.ts:
const BITQUERY_API_URL = "";
const BITQUERY_API_KEY = "";
const axios = require("axios");
async function makeRequest(query: string) {
const result = await axios.post(BITQUERY_API_URL, {
query: query,
headers: {
"Content-Type": "application/json",
"X-API-KEY": BITQUERY_API_KEY
}
});
return result.data;
}
This is how my launch.json looks like:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}\\CheckFMBackup.ts",
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "tsc: build - tsconfig.json",
}
]
}
And here is a glimpse of tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"type": "typescript",
"tsconfig": "tsconfig.json",
"problemMatcher": [
"$tsc"
],
"group": {
"kind": "build",
"isDefault": true
},
"label": "tsc: build - tsconfig.json"
}
]
}
Lastly, my tsconfig.json configuration:
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig.json to read more about this file */
"target": "es2017",
"module": "es2020",
"outDir": "./out",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
}
}