I've heard that a lot of Next.js developer use TypeScript.
I also want to learn TypeScript, but is learning TypeScript worth it?
For further actions, you may consider blocking this person and/or reporting abuse
I've heard that a lot of Next.js developer use TypeScript.
I also want to learn TypeScript, but is learning TypeScript worth it?
For further actions, you may consider blocking this person and/or reporting abuse
sharathchandark -
Edun Rilwan -
FAB Builder | Code Generation -
Shish Singh -
Top comments (26)
In short: YES.
But I think to really get it and use its power to your advantage, you need to have a solid vanilla JS foundation. Understand JS, its types and how to write good, bug free code in JS. Than TS will come as a cool tool to improve your code and productivity. But never forget TS yransforms into JS, so don't go with those who say that TS provides type safety... it helps you document and show you possible mistakes to make sure you have checks and safeguards for good code, but those aren't different from how you should be doing JS 😉
If you have a solid understanding of JS, and can write good, bug free code in JS... you don't need TS
I agree!!! but in large codebases with tons of different datamodels, interfaces/types come quite in handy for someone with an ameba kind of memory like me. Yes I know we have JSDocs, but most my coding those days is writing React, and when comparing TS vs JSDocs and Proptypes, I'm going towards TS lately.
And when TS behavior is stupid (like when using Object.keys() and it says key cannot be used to index my object) I override it with AS T because I know better.
thanks!
so are you saying that it’s easy to migrate from JS to TS?
Yes. In the core TS = JS++. There are stuff specifically to TS, but if you have good knowledge of JS types and best practices it will come easily.
It's definitely worth it to learn TypeScript. You are going to use it sooner or later in your projects because it has various benefits compared to JavaScript. I have started using it in my projects and the experience has been good so far. I'll definitely use it more going forward. It has some learning curve and may not be necessary for every project but for a big project, it definitely helps to catch errors early and overall improve the developer experience.
thanks for your advice!
If you can stomach the hatred of the Vanilla JS cool kids, yes, Typescript is absolutely worth it. As others have already mentioned, Typescript will help you a lot when refactoring and in general, it will make your code a lot less error prone at runtime. It also auto documents the code you write, so other developers can easily see what kind of arguments are expected by a function that you wrote for example. The beauty of Typescript is that it is a superset of Javascript, so you can bring all the Javascript knowledge that you already have and just add typesafety to it :)
Syntactic superset. Identical code in TS may not even run, or do the same thing
This makes TypeScript really appealing, thanks for this!
I like TypeScript. In my opinion, the real power of TypeScript comes when doing code refactors. It's far too easy to make a typo in JS and have it go silently undetected until something subtly goes wrong because a variable is undefined after the refactor.
Plenty of identical tooling exists for JS, I use it daily. Variable renames across multiple files in a large project - no problems at all.
If I understand correctly, the problem with that is that it relies on the developer using the tooling.
It's conceivable that someone (who might be new to the codebase, programming as a whole, or unfamiliar with such tools) goes in and renames a variable by hand without relying on refactoring tools. They might not notice that something elsewhere fails in the product. With Typescript, the transpilation process will fail on the build server during deployment because of typing errors. This would both alert the team that something is wrong, and prevent a broken release from being deployed.
If you know of any plugins that can be inserted into deployment pipelines that can do such analysis with JS, I would be very interested to know!
That seems like a very helpful tool.
I didn't understand the point of TypeScript three years ago - I forced myself to learn it for the sake of the resume - and frankly I would never choose to work on a JS project over a TS project these days.
Regardless of my personal preferences for strongly typed languages - if you've only used dynamic languages (ie: JS and Python) I found the switch from dynamic to strong typing to be incredibly confusing back in my early days, learning TypeScript first I imagine would aid in this transition and broaden your horizons as a developer even further.
Regardless, it's your programming journey and it's important to enjoy the process.
honestly same. i've learnt typescript but i still prefer using JavaScript over TypeScript
If you want to suck all the joy out of coding JS, kill your creativity, and write more code than you need to, then yes, absolutely! 👍
I might seem pretty negative on TS - but my opinions come from a long (39 year) background in programming. I started out with strictly typed languages and have used them for a long time. When I came to JS - it was honestly a breath of fresh air... so easy to be much more productive and creative.
Most devs I know who love TS also come from a strictly typed language background, but their mindsets also seem too 'strict'. Working in, and with JS is a different way of doing things that requires a different way of thinking. If you embrace JS instead of fighting against it - you can free yourself from the straitjacket of strictly typed development.
Yes.
Thanks for your opinion.
This is not just my opinion. It is the de facto industry standard. Not learning it would be foolish to say the least. Virtually every modern application that runs on the front end is written in TypeScript.
ah okay
TS is need for just team-works...
Yes. (Mic Drop) :)
hehe, am I included? Yes, learning typescript is worth it. It helps for medium-large size projects (not really needed for byte-sized projects) so that you don't make so many errors and etc.
ah okay thanks