5 ms·
With such lagging browser support forcing you to compile ES6, it generally makes more sense to jump to TypeScript. You get all the E56 plus things like interfac
by fortythirteen 9y ago
With such lagging browser support forcing you to compile ES6, it generally makes more sense to jump to TypeScript. You get all the E56 plus things like interfaces and enums and, of course, strict typing.
- shados 9y agoThe typing is nice, but shit like enums are a plague in TS. Non-standard crap that will probably never be standard, and in some cases actually are present (in a compiled form) in the output. No, just no. And then you have all of the fun stuff like their original non-standard module system, which is now super confusing in type definitions since it lives side by side with the "real" thing. I'm sure we're gonna have lots of fun having 2 ways of defining private members too. Woo. I assume decorators are gonna be entertaining too since they were based on the older version of the spec (I assume. I did not verify this claim). I love using TS in my side projects because I avoid "the bad parts" (same as with vanilla JS when you think about it), but when we introduce it at work, Im half considering making a lint rule that blocks all the non-standard features that are not related to type checking. Will save some pain in the future.
- coldtea 9y ago>With such lagging browser support forcing you to compile ES6 What lagging browser support? Most of those things have been there for years...
- deleted 9y ago[deleted]
- abritinthebay 9y agoA couple of years in some cases. Many large sites still have to support IE10 and up. Android support was incredibly bad until recently for example, so anyone with a large mobile audience will have issues as well (I still see 100,000s of Android 4.4 requests for example) Not everyone can just support Edge/FF/Chrome evergreen versions.
- cloakandswagger 9y agoStrict typing isn't always desirable, depending on the application of the language. With it you give up a certain level of developer productivity; appropriate if you're using Javascript for backend logic with Node, not so much if you're building simple views with React.
- slackingoff2018 9y agoI don't think so, or at least it doesn't feel like it. Typescript's type inference is so good that you only need types maybe 15% of the time. It also has shortcuts like constructor property initializers and support for async even when targeting ES5. I would bet money that you actually write less code with Typescript than regular javascript because of all the streamlining and shortcuts. And with the type inference you almost get static typing for free. I hear this argument come up frequently against TS and all I can say is I'm fairly sure it's from people that haven't used it.
- fearface 9y agoSometimes it's also from people who use JavaScript in a more functional context, e.g. with currying. Suddenly it requires a lot of effort to still have TypeScripts benefits. https://gist.github.com/donnut/fd56232da58d25ceecf1 https://gist.github.com/donnut/fd56232da58d25ceecf1
- tomelders 9y agoI've been working with Typescript for the past six months. Javascript is starting to shine as a functional programming language, and the communities who develop the useful tools that we actually need are moving in that direction too. Typescript feels like a step in a completely different direction. The problems that TS tries to solve have other solutions. Solutions more idiomatic to javascript development. Redux style architectures, grouping code by feature, libraries over frameworks, GraphQL and so on. And these solutions are solid and dependable. Unlike the made up brittle and often incorrectly defined types that Typescript and Flow demand. If you want to use Typescript, then I hope you really really REALLY like Generics, because they're absolutely everywhere in Typescript. They're the solution to the fundamental flaw with TypeScirpt, it wasn't designed with the actual job that Javascript does in mind. It's Javascript for people who don't like Javascript and don't care to learn it. Well that's fine, each to their own. But people sing it's virtues without pointing out any of the flaws in both the approach or the implementation (maybe because they simply don't see anything wrong), and that really rustles my jimmies.
- mrspeaker 9y agoI don't think it's lagging - it's just working at "internet spec speed". That seems like an eternity, but time flies like an arrow (remember supporting IE5.5?!)... I already use all ES6/7 features (plus modules support with <script type="module">) for many of my personal projects and experiments: no transpilers, no build tools. I like knowing that in 15 years I'll be able to double click an index.html and run/edit my old experiments without worrying about how I'd to find the right version of some long-dead build tool - just like I do with my javascript experiments from 2002!