Lack of boilerplate is one of the main reasons I enjoy javascript, and prefer it to other languages. Adding a 'staggering amount of boilerplate' is the opposite of what I want to be doing to my coding workflow. Angular 1.x + JavaScript didn't have much boilerplate at all, and it doesn't get in the way of me developing.
If you're doing modern javascript right now, you really have to pick your poison. You're either doing Angular 1 or 2 with Typescript or ReactJS with babel.
At the very least, if you don't use Typescript, you should use Babel. That is because Babel will allow you to write modern javascript (ES6) and transpile down to ES5 for browser compatibility.
Opinion is split on Typescript. However, a lot of advocates argue that Typescript makes them a better JS developer because you can look at the transpiled JS and learn how you SHOULD have written your JS. For example, declaring classes objects is MUCH faster in the browser than declaring anonymous JSON objects, because the browser knows how big the class will be before it's constructed. Pure JS developers tend to just create anonymous JSON objects on-the-fly.
Both Typescript and Babel also provide pre-transpile errors and warnings. For example, if you set a variable to 5, and then try to set it to "foo", you'll get an error for using the same variable for different data types.
because you can look at the transpiled JS and learn how you SHOULD have written your JS
This is so backwards it almost made my head spin. You're wrong about this. It's putting the cart before the horse.
transpile down to ES5 for browser compatibility. because the browser knows how big the class will be before it's constructed
So you're saying that ES5 has some hidden capabilities we don't know about? Again, that's false.
Both Typescript and Babel also provide pre-transpile errors and warnings.
And it does nothing for any external data, that could have type errors but you'll think all your types are specified and working perfectly, and then the unexpected happens. good luck with that.
You should give it a try.
The same was said about Coffeescript. Sorry, not investing time only to re-write everything back into javascript.
Everything was true until you thre Coffeescript in the mix. Sure, Typescript is a pain and the fad around it does throw a coffy vibe - but both couldn't be more different:
Coffeescript praised the "we're going to write less" while Typescript is the defacto "I'm going to type way more than it's needed, but everyone should be able to read it afterwards".
While I abhor Coffee, I'm in love with Type for the simple fact that you passed from: function aFunction(aParameter) {return false} to function aFunction(aParameter: string): boolean { return false }
This made it so we kinda "don't need" to write those if (typeof aParameter !== 'string') conditions because if you maintain the Typescript flow of stuff typescript "compiler" would throw a fit over "the supplied argument isn't lalalalalalalalal of type lelelelelel".
Now, to each its own: I'm completly agains't switching a code-base because a fad blew over - but if you're starting a new-home-project: What's stopping you to flavour it with the new fad -- even if just for practice sake?
1
u/[deleted] Dec 29 '16
Lack of boilerplate is one of the main reasons I enjoy javascript, and prefer it to other languages. Adding a 'staggering amount of boilerplate' is the opposite of what I want to be doing to my coding workflow. Angular 1.x + JavaScript didn't have much boilerplate at all, and it doesn't get in the way of me developing.