
JavaScript has been the backbone of web development for decades, powering dynamic and interactive experiences. But as projects grow in complexity, ...
For further actions, you may consider blocking this person and/or reporting abuse
Don't miss the JSDoc possibilities, which is near equal the TS, I can arguing even better on many cases: dev.to/pengeszikra/jsdoc-evangelis...
A big question (to me) is how can be improving the TS/JSDoc in future. Because the problems coming when we need define a complex types, generic, conditional types, specified keys and distinct type as value in a object.
I'm also in team JSDoc, but it's worth pointing out that it's also in many aspects not as complete as writing TypeScript.
Just recently I had to discover that there's no good way of defining abstract classes or methods, and there's plenty of other sharp corners that can cost you 10 minutes here, 15 minutes there, and make the experience quite frustrating on occasions.
JsDoc wouldn't be able to work without the existence of TypeScript. JsDoc piggyback rides on TS. Talking about JsDoc to document can't exclude TS from the conversation, and the independent one is TS.
Furthermore, complex structures and reusable types have to be done in TS because JsDoc has this limitation, last time I checked.
JSDoc does not depend on TypeScript; Intellisense (type hints) does. The actual documentation generator that is JSDoc does not. Admittedly fewer people are probably using the documentation generator than the type hints these days.
I used Closure Compiler a decade or so ago when the JSDoc comments provided build-time benefits.
The interactive benefits – which are massive – are now built on TypeScript and thanks to the TS support have improved JSDoc. We're using JSDoc in an older codebase but benefitting from the TS updates to it.
JSDoc can working alone, the only difference netween TS and JSDoc is:
In JSDoc don't have enum & interface. Allo other works fine.
My complex example is:
dev.to/pengeszikra/javascript-grea...
I think you are misunderstanding: Every JsDoc interpreter uses TypeScript to to provide Intellisense. Also, JsDoc uses TypeScript's syntax. In other words, JsDoc couldn't type if TS didn't existed.
Yes you totally right! Even JSDoc can use TS types and TS can use JSDoc types
JsDoc is a documentation tool, not a type checker. It is really just TypeScript supporting some JsDoc annotations as an alternative syntax.
Under my test JSDoc can use any advanced TS type declaration. Even I can write a react-state handling improvement npm module: npmjs.com/package/jsdoc-duck with JSDoc. And that is real complex type problem, because the input is the user defined type ( TS or JSDoc ) and the result is a proper typed actions set for useReducer.
Another question is a few months later I try to use frameworkless solution, so I keep my React experience to my job. But hobby level turn to different way ( where JSDoc is perfect )
Maybe show me a real comple TS definition, which I can't able to recreate with JSDoc.
Again, JSDoc is only a documenting tool with an established syntax for annotation comments. It is still the typescript language server that evaluates these annotations and checks the types of your program accordingly.
JSDoc contributed the syntax, TypeScript the actual implementation.
This shows, for example, in how several JSDoc annotations such as
@abstract
aren't supported by TypeScript.Yes JSDoc started as documenting tool and even capable to store a markdawn example also with a proper IDE plugin. But:
At the end: in developer perspective this two tools are give near same type hints and alerts for our code under development time.
Whether it is small or big project, go for Typescript. In my opinion beginners should learn Typescript as soon as possible. No need of killing your time learning JavaScript. When I was a beginner, I spent too much time studying JavaScript. If I had spent that amount of time on Typescript, I would have become Typescript wizard by now.
TypeScript is JavaScript with compile-time type checking and otherwise only very basic transpilation. No amount of time learning javascript will be wasted on TS, because it's what ultimately runs in the browser.
Knowing what's what is definitely good to know though, and the JS/TS combo is a great chance for new developers to gain experience with both typed and untyped languages. Intentionally avoiding this comparison isn't going to help anyone become a better developer.
Someone who is learning Typescript is also learning Javascript at the same time. No one is avoiding Javascript. Learning TS means learning Javascript under the hood.
It is literally the same as "killing two flies with one swat".
So as I said previously, there is no need of spending too much time learning Javascript. Learn Typescript very well then you are good to go.
Great breakdown! I'm a TypeScript fan myself—those early error catches have saved me from so many headaches, especially on bigger projects. That said, JavaScript’s “get it done” vibe is still unbeatable for quick hacks or small scripts. Love how you laid out the trade-offs so clearly—definitely sharing this with my team! 🚀
Agreed! TS for safety, JS for speed. Hope your team finds it helpful too 😊
JS for speed, JSDoc for safety.
For speed of what?
Your question is already answered in the top-level comment: Speed of development.
Coming from C and C++, Typescript was the obvious choice as types are very important for me:
The only problem is that some libraries are not typed, and it becomes a mess to use them in Typescript (yes Strapi I'm talking about you).
EDIT: typos
It's really not that absolute: JavaScript tooling can already tell you about some problems in advance (like invalid syntax, using undefined variables, etc), and type checking won't find all potential problems.
You really only get a few more categories of problems checked at compile-time that you then don't need to test for.
The smaller the team, the better for TypeScript. Sure, extra code, but if you're the kind of guy that has several projects and POC's going on at the same time, sometimes you return to a project after months. TS will help a lot to go back to where you left.
Generally speaking, JS is only for very, very small POC's. TS for everything else. Team prefers minimal tooling? Too bad. Not happening.
Absolutely agree with you!