JavaScript and TypeScript are both popular languages for web Devs. TypeScript allows you to include types in your script, something like Java I guess. So is it worth learning TypeScript or is JavaScript enough? Does one have perks over the other and how?
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (14)
TypeScript is just JavaScript with some extensions from upcoming standards and a transpile-time type checker. The aforementioned extensions (which you can also get by using babel instead) will make some things a lot easier. The type checker will require some work to declare the types, which will usually be repayed once it catches bugs and helps with better IDE integration - however, for smaller projects, it's probably not worth it.
So, as a rule of thumb, with more than 2 front end developers and more than ~1000 lines of code, choose TypeScript, otherwise go for JavaScript. YMMV.
Thanks @alex Lohr
That was really helpful š
You could just stick with JavaScript. It is totally enough. Though, if you want to learn TypeScript it isn't that hard especially since valid JavaScript is valid TypeScript so if you think that for your project you really only need types to be more concise, you only do types. If you think you only want interfaces, you only do interfaces.
TypeScript is valuable when you have a project that's grown so big and complicated you can no longer keep it in your head or understand it. Once you've arrived at this point, it's a good time to learn TypeScript.
If you haven't arrived at this point yet, you might not need TypeScript for the development that you're doing.
Depending on the market place you want to be in.
JavaScript is a must and essential while Typescript is optional. Meaning you can build a react or angular App usign typescript or JavaScript, but you'll need plain JavaScript for adding some functionality to non-SPA websites/webapps or for using Svelte or other frameworks (don't know if it currently supports TS).
Appart from that, TS is a JavaScript superset, this means it uses the full JS api while adding some extra features.
My advice would be to learn JavaScript first then put your hands into TS.
When you are used to JS messes you will apply your knowledge on other languages to avoid this "issues" so you'll be more close to TS, then the switch from JavaScript to typescript will be smooth.
The competitor that raises against JS is web assembly. You cannot compile JS into WA (for obvious reasons, ask if you want more details) so JS is out of the equation, you can use Rust, Kotlin or many other languages to compile to WA.
TS is great for React, for example.
pagepro.co/blog/three-advantages-o...
Oh, is it? Because I'm interested in React web dev. Thanks!!!
Definitely recommended then! :)
Learn JS first. TS adds features that are most useful when working on a shared/large codebase; and once you're proficient with JS using TS is fairly straightforward.
What is your goal? Knowing TypeScript might be helpful in maintaining some codebase, and of course TypeScript is popular, and a well structured way.
JavaScript might not be so bad, if you don't try to support most older browsers. The ways around this is not only TypeScript, but also Babel / Webpack. Perhaps also with JSDoc or Flow, to add typing.
TypeScript is not the only way to try to fix JavaScript as well. But I do agree that it is both approachable, and near-bare-bone JavaScript.
Perks of TypeScript? Actually, it is not always strongly-typed enough. But its typing system is both flexible and near-perfect to me.
Furthermore, you can easily use bare JavaScript without TypeScript or Babel in Node / Electron.
JavaScript is enough. Once you are good in JavaScript, you can learn TypeScript within a few hours.
Ts
Typescript will help you code better with types but plain old javascript is just fine !