Skip to content

Instantly share code, notes, and snippets.

@4sskick
Last active February 23, 2024 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 4sskick/63fd2126313caadc8f27a487fd52fd22 to your computer and use it in GitHub Desktop.
Save 4sskick/63fd2126313caadc8f27a487fd52fd22 to your computer and use it in GitHub Desktop.
run ts on js node folder project
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`
{
"scripts": {
"start": "ts-node"
},
"devDependencies": {
"ts-node": "^10.9.2",
"typescript": "4.5.4"
}
}
{
"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