How to write Node.js TypeScript?

Theoretically, it is possible to write code in ts and compile it into commonjs then to be used node.js right?

Or is it a method, you break the head?
April 19th 20 at 12:03
3 answers
April 19th 20 at 12:05
Solution
April 19th 20 at 12:07
Well, in tsconfig indicate moduleResolution: node; module: commonjs, and compile, and all you have beautiful, lush, with typechecking. By the way, sometimes the output code is much more effective than written in js Krivoruchko like me. In the Microsoft were not stupid.

UPD. edited.
By the way, sometimes the output code is much more effective than written in js Krivoruchko like me
Why should you be? TS does no code optimizations. - Prince8 commented on April 19th 20 at 12:10
April 19th 20 at 12:09
Nest.js or google -> the name of the framework, typescript starter.
Used a bunch koa + typescript + inversify.js all compiles will volchitsa and works great.

Find more questions by tags Node.js