Node JS Tutorial in Hindi #64 How to Use TypeScript with Node JS
Add TypeScript in Node js
Points of video:-
- Create package.json
- Install NPM packages
- Create config file
- Make src file
- Make index.ts
- Write some code
- Add script in package.jsn
- Run Code
- Interview Questions
- Notes, Code and playlist.
dependencies that need to install
- typescript: The TypeScript compiler
- ts-node: Allows running TypeScript files directly
- @types/node: Type definitions for Node.js APIs
src/index.ts file code
const helloUser =(name:string):string=>{
return name
}
console.log(helloUser("Anil sidhu"));
console.log(helloUser("sam1"));
github link for code :- https://github.com/anil-sidhu/node-express-mongodb/tree/typescript-with-node