5 ms·
I love JS/ES2016 how it is, I seriosuly don't see the advantage of typescript except maybe for a gigantic application
by caub 10y ago
I love JS/ES2016 how it is, I seriosuly don't see the advantage of typescript except maybe for a gigantic application
- retox 10y agoAm I missing something? None of the major browsers even support ES2016 yet do they? https://en.wikipedia.org/wiki/ECMAScript#Implementations https://en.wikipedia.org/wiki/ECMAScript#Implementations
- exception_e 10y agoMost people use Babel to write ES2015/ES7 code that turns into ES5 compatible code: http://babeljs.io/ http://babeljs.io/
- caub 10y agoyea, babel, as exception replied
- WayneBro 10y ago> seriosuly Well, if English were statically typed, the compiler would have caught your spelling mistake before you submitted your comment. Types are valuable for any size application. They bring order to a chaotic world. If you don't do static typing, you have to do a lot more unit testing. You also have to type out a lot of code to convert your function arguments into the types that you actually wanted. So, you're spending your time either way. Specifying types up front takes way less time than writing unit tests or converting arguments.
- koolba 10y ago> Well, if English were statically typed, the compiler would have caught your spelling mistake before you submitted your comment. Ha! I love seeing things like this on HN and think it's a perfect example to illustrate the power of static typing. Kudos!
- talmand 10y agoI fail to see what typing and a typo have to do with each other to make that joke worthwhile.
- koolba 10y ago> I fail to see what typing and a typo have to do with each other to make that joke worthwhile. Well to be fair it's more about static analysis vs catching typos though they tend to go hand in hand. I suppose a more apt analogy would be transposing a letter in the sentence where it was still spelled corrected but the part of speech changed from a noun to a verb.
- jasonkostempski 10y agoIt would have passed static checking if using UDL (Urban Dictionary Language).
- caub 10y agoI agree hehe, JS may possibly move more and more in this direction
- leshow 10y agoI think even in large applications its not well suited because the type system has an 'escape hatch' in the form of any and null/undefined. IMO Elm is probably a better candidate, or Flow if you like the more imperative syntax.
- gjolund 10y agoI have had a lot of trouble explaining the benefits of static analysis, type interfaces, generic types, etc. to my js dev colleagues. I think that what it breaks down to is that a chunk of your education is missing, and you won't "get it" until you catch up. There are gigantic advantages to leveraging the compiler while developing. It makes refactoring a breeze, testing intuitive, and it gives you an additional safety net before deploying code. Sure, there are benefits to writing vanilla js. I still do it from time to time while prototyping. However if you are writing javascript in a professional context on an application that needs to be stable, testable, and maintainable by a potentially distributed team, then Typescript is a no brainer (for front-end, back-end the debate rages).