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.
yeah, already supports. - genevieve_Upton commented on July 9th 19 at 10:12
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
This is not so. - guiseppe commented on July 9th 19 at 10:33