Last active
February 23, 2024 10:29
-
-
Save 4sskick/63fd2126313caadc8f27a487fd52fd22 to your computer and use it in GitHub Desktop.
run ts on js node folder project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I have folder project which run a js file, by default it will only run a JS files. I want to make it run the TS file, also able to use console.log as JS file do | |
- create `package.json` see file below | |
- create `tsconfig.json` see file below | |
- do npm install, and they will do the rest | |
- done, then run ts file with `npm start ts_file.ts` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"start": "ts-node" | |
}, | |
"devDependencies": { | |
"ts-node": "^10.9.2", | |
"typescript": "4.5.4" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"compilerOptions": { | |
"target": "ES5", | |
"module": "CommonJS", | |
"lib": ["ES6", "DOM"], | |
"strict": true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment