Node JS Tutorial in Hindi #64 How to Use TypeScript with Node JS

Add TypeScript in Node js


Points of video:-

  1. Create package.json
  2. Install NPM packages
  3. Create config file
  4. Make src file
  5. Make index.ts
  6. Write some code
  7. Add script in package.jsn
  8. Run Code
  9. Interview Questions
  10. Notes, Code and playlist.


dependencies that need to install

  1. typescript: The TypeScript compiler
  2. ts-node: Allows running TypeScript files directly
  3. @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