If you're just starting your coding journey or looking to level up your skills, you might be wondering whether to learn JavaScript or TypeScript. J...
For further actions, you may consider blocking this person and/or reporting abuse
Typescript is not bad at the end but JSDoc is fare more versatile, compatible with TS, even use TS types from TS module, but can work without compiling. JSDoc vs TS
JSDoc can't enforce type checks like TS, without enforcing half of the team won't care.
Bigger the team - more benefits from Typescript.
I used to be a TS hater and advocated for JSDoc once.
JSDoc can also configure to force type check, without extra
// @ts-check
With
tsc
? No, thanks, JSDoc is for documentation, can put examples and links there.Can't put more or less complex types in JSDoc btw, generics for example, maybe on closure compiler only, debug types also harder.
JsDoc can’t replace TS and using it with TS is just great for big teams
JSDoc can use all complex type solution, even generic: (take look this npm module, written in JSDoc)[npmjs.com/package/jsdoc-duck]
Less than 100 LOC, and seems like nobody uses it. Not a good example.
Types will never be fully properly supported in JSDoc.
github.com/microsoft/TypeScript/is...
github.com/microsoft/TypeScript/is...
I tried to use JSDoc for types myself, it's a pain, and no benefits, way worse than Typescript.
But good to put usage examples and link to docs there
Thx for your comments.
I brought to table that npm module, because a first I created a good reason - make a useReducer typesafe and easier handle. I don't beleive a too many code lines if problem can be solved a much lighter way.
Main reasion this npm module is proof the JSDoc Generic working perfect and make a life easier.
I even know hard to argue the typesafe useReducer is a valuable stuff, or even hard to argue react is neccecary framework for so many project, currently I try explore the pure html development instead using any freamwork - that why don't spend time to improve that library.
On pure html the JSDoc also hyper helpfull.
Reinventing the wheel every time is a bad idea. Way easier when you have framework/tool and documentation with stack overflow answers.
You will get it if you work on a bigger project with many people.
Good advice. Maybe easier way still exist, maybe sometimes worth to try another way. I am work on a bigger project with many people ( bit legacy react stuff - 3-7yeard old code ). This is push me to JSDoc direction, because in this project we don't have option to rewrite a full code to TS.
Pure HTML way comming: our deployment process is painfull slow on AWS, so I trying what is the difference between no build, no compile, no framework coding vs. standard framework using. And my first impression is surprising fine, like the lost your chain. ( dependency chain )
Can enable
allowJs
and start rewriting file by file, obstacle if it is management decision.I remember how Frontend development started, it was pure JS + JQuery, no frameworks. People started to invent things, it was so messy that can't possibly figure out somebody else code if everything written from scratch. That how frameworks got popular. Frameworks gives solution to very common tasks and make code somehow readable.
AWS is a problem, builders are fine, things like Vite at least fast enough, only Next.js still slow af.
Actually JSDoc is great option if you want suggestions without committing to ts and its sometimes complicated type errors. I do use JSDoc in Ts or Js project for documentations of helpers and utilities
It's easy to forget that just because you are writing typescript it's just same old dodgy JavaScript at runetime with many many weird edgecases!
Not learning Javascript is like saying you are chef if you can make yourself breakfast.
Cant agree more
Vanilla Javascript is much simpler yet efficient and if one has good programming skills and does coding properly, it's very fast. No need to typecast all variable.s in fact that's strength of JavaScript. Why to add layers on the language which is interpreted and then make it compiled language.
So you get less runtime errors... And yes, that happens a lot. People change function implementations all the time. If some function return type changes and your code that uses that function expects an object with a certain property to be returned and its suddenly not available anymore, you're dead.
Thats a very good point. TS is must have for such refactoring
Today only i was building a temporary server. Started with js and then realised i have keep types of functions parameters in check and altered the files to index.js to index.ts 😂😂😂
IMO, JavaScript's implicit nature is much easier to learn than TypeScripts explicit nature.
JavaScript's makes it easier for beginners to jump into coding without needing to understand types or deal with strict errors. Especially for smaller projects they are typically working on, TypeScript can feel like over engineering.
I personally stay away from TypeScript because I can write my own JavaScript, thank you. And because I'm cognizant that dynamic typing is not a crutch, but a super power.
This one's obvious. JavaScript's ability to inherently operates without requiring additional type annotations and configurations upfront, which can slow down prototyping.
Also, JavaScript can "Just get it working" quickly, running directly in browsers or environments like Node.js without a compile step like TypeScript requires.
Also, JavaScript's polymorphisms is seamless, built-in without needing to configuring overloads or generics. While TypeScript can do this with any or unions, it's a conscious choice rather than an automatic and natural behavior.
In a nutshell, JavaScript defaults to flexibility and makes it more natural to fit where dynamic behavior is a first-class requirement. Its superpower is the ability to keep things simple and dynamic and never enforce structures unless it is really necessary.
Thanks for the article.
I agree with your point about the "compile step" and the initial configuration challenges of TypeScript—I’ve spent a fair amount of time getting it right myself.
That said, I don’t see myself going back to JavaScript. TypeScript has saved me from countless bugs, especially those caused by simple typos. And when it comes to refactoring, TypeScript is a game-changer.
I do a lot of refactoring since I’m often the one maintaining the codebase in most of the projects I work on. With TypeScript, I can make sweeping changes confidently, knowing the type system will catch any mistakes.
For me, the upfront investment in setup and learning TypeScript pays off exponentially in the long run, especially for larger or long-lived projects.
I completely understand what you're thinking. Long term though, it's a Microsoft language. They will force you to upgrade some historically speaking.
lol so true
Great insights! I'm curious, is it worth starting with TypeScript for a small project, or should I stick to JavaScript until I build something bigger?
Best way to learn is by applying it.
I use to hate TS, now I can't imagine going back to JS again. I recommend to start with TS right away.
Feeling is mutual
definetly, start small for better trackability
I thought JS doesn't require semicolons?
Semicolon is needed, just most of the times JS can correctly assume it's location, but not always.
Oh this is new to me. I will keep this in mind
Thats an optional thing. it works with and without it. I prefer facing without semis
TypeScript definitely feels like a superpower after reading this! The gradual learning curve you mentioned is such a relief for beginners like me
Happy that article helped with yo TS journey
Typescript with deno is also good start where you can just start using typescript without worrying about anything.
Actually that’s a thought. I haven’t tried deno but i should now
Typescript FTW in JS world since people are writing such a sh*tty code its ridiculous.
We all start from JS. But yeah I cant imagine myself writing code without TS. Code auto complete and lint as big help avoiding ridiculous typos can make you waste 2 whole days.
You’ve explained why TypeScript is such a game-changer
hey thanks
How long do you think it takes to get comfortable with advanced TypeScript features like generics or utility types?
For me it took an 6 months window or learning and making, more you build better you get
The resources you listed for learning TypeScript are gold! Thanks for not just explaining the 'why' but also giving us the 'how' to get started
Happy that they helped
You mentioned Chakra UI and its TypeScript support—do you think it’s better for beginners than other UI frameworks?
I definitely think that