EXAMPLE AND INSTRUCTIONS TO CONFIGURE:
- TYPESCRIPT: A SYNTACTIC SUPERSET OF JAVASCRIPT WHICH ADDS OPTIONAL STATIC TYPING TO THE LANGUAGE.
- NODEMON: FOLLOW THE INSTRUCTIONS HERE.
npm install -D typescript
npm install -D @types/node
-
CREATE tsconfig.json:
npx tsc --init --allowSyntheticDefaultImports true --lib ES2021 --module ES2020 --moduleResolution node --target ES2021 --rootDir ./folderSource --outDir ./folderDist --removeComments true --resolveJsonModule true --types node
-
RESTART VSCODE.
-
IF YOU ARE USING GIT, ADD folderDist AS A NEW LINE IN .gitignore.
npx tsc # TRANSPILE ALL _.ts_ FILES IN _folderSource_ TO _.js_ FILES IN _folderDist_
node ./folderDist/folderTopics/folderTypescript/exampleTypescript.js
CREATE THE COMMAND npm run tsc-nodemon
BY ADDING THE FOLLOWING LINES TO THE script ENTRY IN package.json:
"tsc-nodemon": "nodemon --exec \"tsc --skipLibCheck && node %npm_config_jsfile%\"",
npm run tsc-nodemon --jsfile=./folderDist/folderTopics/folderTypescript/exampleTypescript.js