Is it possible to write on TypeScript under NodeJS?

The question, is it a good practice? Will I be able to use without any problems packages from npm, or some third-party scripts/classes are written in js?
Need all the pros and cons of this approach, I want to know whether to start a nodejs project on ts, or limit it to es6.
p.s. I read that in 1.8 ts is some thing that effortlessly adapts any code, but do not know how effective it is
July 9th 19 at 10:05
2 answers
July 9th 19 at 10:07
Solution
Is it possible to write on TypeScript under NodeJS? The question, is it a good practice?

Yeah, yeah
Will I be able to use without any problems packages from npm, or some third-party scripts/classes are written in js?

If you understand what is needed .d.ts-files and how to use typings, you will have no problems.

Pros:
fresh features from spec ES
- static typing, and, consequently, all the advantages that it provides. in a nutshell: part of the error will otlavlivatsya prior to the launch and thus need less testing
good language support all sorts of editors. IDE from Jetbrains would be better to give hints. And even simple code editors, e.g. Atom, Sublime, VS Code will issue the normal prompt, go to the definitions in the code to give the signature of methods, etc.

Cons:
- You need to understand how to connect a simple js library to the project. In General, it is not difficult, but many do not master.
- The types "exist" only in compile-time. The output is normal JS with all its dynamic nature. If the code is written poorly (for example, often used the any type), then typescript will help.

And about the debugging I have already said: it is no problem. Just need to connect this thing, and everything will be fine. VS Code definitely knows how to connect to motovskomu (and chromosome) and the debugger will jump at the source, not a compiled mess.
July 9th 19 at 10:09
Pros:
- Syntactic sugar - it's delicious and nice feel and makes coding easier.
Cons:
- Debug the code generated by the machine for the machine, no comment.

The word ES2015, and the other is still 100% syntactic sugar, from time to time until he Node will not support the new standard.

The first thing you need to think - how to debug such a project in real time, using breakpoints.
> while the Node itself will not support
yeah, already supports. - genevieve_Upton commented on July 9th 19 at 10:12
: you mean Babel? - abigail36 commented on July 9th 19 at 10:15
: I'll have to try) - abigail36 commented on July 9th 19 at 10:18
: no Babel, nodejs podejrzewam all added to webkit, not added, as far as I know, the only support modules. - aiyana.Marv commented on July 9th 19 at 10:21
: I mean the Node 6. - genevieve_Upton commented on July 9th 19 at 10:24

Cons:
Debugging code generated by machine to machine


For such things long ago came up with source maps. For nodes, they also exist and work fine with Typescript: https://github.com/evanw/node-source-map-support#t... - rubie_Kul commented on July 9th 19 at 10:27
+1, the debugger shows the code ts in the presence of source maps. - aron8 commented on July 9th 19 at 10:30
>> By the way ES2015, and the other is still 100% syntactic sugar
This is not so. - guiseppe commented on July 9th 19 at 10:33

Find more questions by tags JavaScriptNode.jsTypeScript