K
K
Konstantin2020-04-15 01:08:19
Node.js
Konstantin, 2020-04-15 01:08:19

How to write Node.js in TypeScript?

Theoretically, you can write code in ts and compile it to commonjs so that you can then use it in node.js, right?

Or is it a method, break your head?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry Belyaev, 2020-04-15
@Junart1

https://www.npmjs.com/package/ts-node

2
2CHEVSKII, 2020-04-15
@2chevskii

Well, in tsconfig you specify moduleResolution: node; module: commonjs, and compile, and everything works beautifully, juicy, with typechecking. By the way, sometimes the output code is much more efficient than that written in js by cranks like me. Microsoft is not stupid.
UPD. edited.

A
Alex, 2020-04-15
@mr_ko

Nest.js or google -> framework name typescript starter.
I use a bunch of koa + typescript + inversify.js, everything compiles, reads and works with a bang.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question