5 ms·
Yes, but they completely undermine the appeal of JavaScript for getting things done quickly and easily for the JS-competent. If I wanted to write my JavaScript
by abalashov 10y ago
Yes, but they completely undermine the appeal of JavaScript for getting things done quickly and easily for the JS-competent. If I wanted to write my JavaScript as bureaucratically as one writes Java or C#, I'd just use those languages.
Also, Angular 2 claims to be TS vs. ES6 agnostic, but practically, all documentation and resources are TS-orientated. That's more what I meant by fascism.
As far as the language premiums offered by TS: if I otherwise had to write ES5, I could see the value. With all the improvements offered by ES6—sure, type safety is not among them, but alas—I don't see any reason to use TS.
- DCoder 10y ago> getting things done quickly and easily Sure, fast turnaround is good. Being able to maintain and refactor what you made a year later is even better. I'm currently refactoring an app that has ~30k sloc TypeScript, and doing it without types would be a lot worse. However, my app is not built in Angular, so my experience here may be quite different.
- abalashov 10y agoI'll buy that. I'll also buy that the discipline of TS—like Java—is useful on large enterprise projects and/or on large teams, especially if the aim is to limit the amount of damage that can be done by ordinary J2EE H1Bs at Accenture. But that's no reason to force its use as a precondition of using a notionally JS framework.
- jolux 10y agoIt's sort of sad that TS inspires comparisons to the bureaucratic, manifestly typed languages like the perennial Hacker News bashees C# and Java and not the graceful type inference of some functional languages. These languages being the face of strong static typing betray the ability of types to make a programming language both safer and more expressive.
- abalashov 10y agoI think it's a red herring. TS's typing isn't the only thing that is true about it, and is not the salient issue here. Were TS merely to force types upon me, I think I'd have few grievances with it. Yes, yes, I know—it's (2.x) a superset of ES6. But just you try writing Angular 2 code in such "ES6". No, you have to play ball with generics and the full gamut of Java features.
- jolux 10y agoI guess I don't understand why generics are "Java features?"
- deleted 10y ago[deleted]
- DCoder 10y agoGenerics are a pretty integral part of the type system, not a "Java feature". And TS has other good features besides types, e.g. transpiling to ES5, async/await, TSX, decorators. What does pure ES6 offer instead? I am avoiding Angular entirely (I'm not a fan of the "and the kitchen sink" approach it promotes), so I can't comment if they're taking TS too far.
- shados 10y agobecause it is closer to java or C# than it is to the more advanced functional languages. Yeah, it has structural typing, some type inference and pinky swearing type guards. It is better in those regards. But you still don't get very far without annotations. C# had inference for anonymous objects and return values too, and TypeScript is only a little further ahead on that one. Though the main problem with TS is how it actually gets used. You certainly CAN do java-like garbage with it, and god do people do. If you're not stuck with people doing that, it's not half bad.
- jolux 10y agoIt's just sort of a shame that TS is winning out over Flow. I remain convinced that the latter is better.
- jgalt212 10y ago> ordinary J2EE H1Bs at Accenture you probably don't see that phrase in their marketing materials.
- hexsprite 10y agoI don't see any reason not to use TypeScript as all of the type safety is totally optional depending on how you configure. So you can write freely but start adding types for critical pieces of code when it becomes worthwhile.