4 ms·
I've been considering the jump into TS, but I don't want to end up in a coffeescript situation (i.e. language is dead, but code lingers on and has to be convert
by tenaciousDaniel 6y ago
I've been considering the jump into TS, but I don't want to end up in a coffeescript situation (i.e. language is dead, but code lingers on and has to be converted back to JS at some point, rather painfully). Do you think it's worth it?
- slewis 6y agoYes. It’s built by Microsoft and has huge adoption. Typescript is here to stay.
- akie 6y agoWhat if most of TypeScript is embedded into the next version of JavaScript, as happened with Coffeescript?
- StrangeSound 6y agoThen there's not really a problem. You learned how it works, and now it's one less thing to worry about
- hombre_fatal 6y agoAlso, if Javascript got its own type system somehow (not gonna happen anytime soon), you could expect Typescript to compile to it. And you could transition off of Typescript just as gradually as you could transition on to it.
- zdragnar 6y agoTypescript offers almost no runtime behavior. With a few exceptions, everything is stripped out, and it only offers to transpile modern JS features to older browsers. CoffeeScript was all about an alternate syntax for runtime behavior. JS isn't going to get compile time anything. There was an attempt at adding "strong mode" by one of the google / chrome teams iirc and that went nowhere.
- Zarel 6y agoAll I really wanted was to allow type annotations in JavaScript. So you wouldn't need a compile step while running (JavaScript would just ignore the type signatures), but TypeScript could check it whenever. I believe this is the approach Python uses. I think there were discussions of doing that at some point, but it seems to have gone nowhere.
- JackMorgan 6y agoI just switched a pretty huge project into TS, and I'm seeing for this team and project, probably 4 units of saved time in the PRO column, and 3 units of lost time in the CON column. Still worth it, but you'll need to learn and maintain a new thing, and sometimes doing a totally normal JavaScript thing would force you to write some pretty eldrich type signatures.
- carry_bit 6y agoUnlike coffeescript which had a fundamentally different syntax, typescript is just modern javascript plus types.
- davnicwil 6y agoI agree and won't repeat this point in a sibling comment, but just a slight nuance is that there are in fact some extra features/syntax TS has that JS doesn't, such as enums. You have to be aware these features would need to be manually converted back to JS were you ever to switch back. Honestly this would likely not be a significant amount of work, especially if you don't overuse them, but just to make you (GP) aware.
- fpoling 6y agoYou may also consider Flow. It is literally JavaScript plus type annotations. The annotations can be even put into comments turning the files into vanilla JS making this very clear. So there is no danger that if FB abandons it one ends up with code that needs to be converted. On the other hand Flow is much less cool than TypeScript these days. Plus using it for development under Windows have issues, although FB has started paying attention to them.
- Zarel 6y agoTypeScript annotations can also be put into comments. I like TypeScript's approach (JSDoc) better, actually, because it's how you'd want to annotate them even if you didn't have a typechecker, anyway. Although I still hit enough annoyances that I'd go straight to `.ts` files for my next project.
- FeloniousHam 6y agoWe started out with Flow, but moved to Typescript not because it's "cool" (I suspect it's the Flow users who are smoking clove cigarettes in black berets), but because the language improvements and tooling support are a huge productivity boost. The killer is how flexible it is, it incrementally scales from straight JS to full-on type religion. You only have to use as much as you find useful.
- TechBro8615 6y agoIf you decide to make the jump, I found tsdx to be really useful boilerplate generator for getting started: https://github.com/jaredpalmer/tsdx https://github.com/jaredpalmer/tsdx
- mercer 6y agoI've been doing less and less JS stuff, but I actually miss TS at times. I think it won't end up like CoffeeScript, and it's absolutely worth using if you need to write javascript!