Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Download typescript (tsc), then initialize it in a directory (tsc --init). Create some typescript files for fun and run tsc
-
Voxera113884yFirst, typescript is a superset of js so all js is valid typescript.
So use any tutorial to get some typescript example running and start experimenting. -
@Mb3leb The move to TypeScript is absolutely worth it!
Just @ me, if you ned help. I have been using it for 4.5 years now and it saved me lots of headaches.
JS is not terrible, but just more prone to typing problems during coding errors etc.
As @Voxera basically said, you don't need to migrate everything at once. Just keep trying to learn step by step and apply what fits you best.
The hardest part is getting to know what you want to build for and whether you need a bundler like Webpack.
For web you will need a bundler if you go the modular way (import/export).
For node you don't need one, but chosing the right ECMA target is key.
I use Webpack for all Web builds using "ts-loader" and terser (minifying).
If you build for NodeJS, using TSC is sufficient.
To start, just type "npm i --save-dev typescript" in your project to have the TS transpiler.
For NodeJS targets, you can use "ts-node" (in NPM) to directly run and debug TS code. A you can set up for example the VS Code debugger to use ts-node, so you can directly step through your code.
Also if you dislike Node, you cam try out "Deno", it runs TS directly. I've yet to try it myself though...
Related Rants
I have the will of migration from Javascript to typescript but i don't know where and how.
rant
migrating
scaling
ts
js to ts