Linux serverlinux web serverNETWORK ADMINISTRATIONS

How to Setup Node.js with TypeScript in 2023

Learn how to setup Node.js with TypeScript while supporting native ES modules. Use the new NodeNext option to easily interop between CommonJS and ES modules in the same project.

Full Lesson and Source Code https://fireship.io/lessons/typescript-nodejs-setup/

source

by Beyond Fireship

linux http server

20 thoughts on “How to Setup Node.js with TypeScript in 2023

  • Now if I want to host backend then I will only host that dist folder , am I right..?

  • An hour looking for a minimal typescript setup with clear explanations. I should have known to come here immediately.

  • how would i run that code so it prints on my console?

  • "noEmit": true,
    "allowImportingTsExtensions": true,

    adding these two will allow you to import ts files as .ts files only.

  • okey and now what the fuck do I do? I have a index.js file that's 94863847682384435876348 characters long and has an error at line 7654375643 saying I'm missing a ;

  • you skip the step of creating index.ts and tsconfig.ts file

  • THANK YOU. I DECLARED WAR ON TYPESCRIPT FOR THE PAST 1 HOUR TO GET IT WORKING. This took 3 minutes…

  • Million likes for this video! I spent the entire day debugging until I stumbled upon your video. Turns out, the issue was that I was importing a common JS package without specifying {"type":"module"} in the package.json. Thank you so much! ❤❤❤❤❤

  • the more I setup node projects, the more I realize how riddled it is with caveats and weird behaviours…

  • Who has the error: ERR_UNKNOWN_FILE_EXTENSIONr

    You need to install tsx instead of ts-node and change it in nodemon.json if you use it, in the exec line, accordingly.

  • What the fuck? How confusing is it to have to import it with a filename that ISNT the extension of the file you are actually trying to ref….

  • Thanks a lot. Now I know that I don't want to use typescript ever. Such a time waste.

  • Great video.
    This reminded me of the reason I don't like web dev… too many moving parts just to get a simple webpage to run.

  • man why didn't you use nodemon ? 'cause every time we update the files we have to rerun same command

Comments are closed.