3 ms·
Tell that to the mountain of "few thousand line SLOC" javascript projects that existed and continue to exist before Anders Hejlsberg embarked on his mission to
by dimitrios1 5y ago
Tell that to the mountain of "few thousand line SLOC" javascript projects that existed and continue to exist before Anders Hejlsberg embarked on his mission to C#-ify javascript. I am not opposed to adding strong type checking to JavaScript, but Typescript ain't it.
- morgancmartin 5y agoI agree that TypeScript leaves something to be desired, but it is far and away a better alternative to pure JS. TS may not be total, but it comes close enough to get the job done for the dynamic environment it's meant to target assuming operators competent enough to lean on what it offers. I should also note, I've attempted OOP in TS and it wasn't pretty. It is much more suited to a functional style IME, although I will concede I have seen some open source projects that use it in a Java-esque OOP style presumably to good effect. Personally it wasn't my cup of tea.
- wing-_-nuts 5y ago>Typescript ain't it. Expand please?
- jamil7 5y agoI think what the parent is getting at that Typescript doesn't try to give you the kind of guarantees that something like Rust, Swift, Elm etc. can. They are upfront about this though and it's stated here in the design goals as a non-goal https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals#non-goals https://github.com/Microsoft/TypeScript/wiki/TypeScript-Desi...
- k_ 5y ago> I am not opposed to adding strong type checking to JavaScript, but Typescript ain't it. If you are curious about this, you might be interested in checking out Haxe [0]. It has static typing, type inference, pattern matching [1] (maybe not on par with ML languages, but still good), and can transpile to multiple targets [2] including JS. [0]: https://haxe.org https://haxe.org [1]: https://haxe.org/manual/lf-pattern-matching.html https://haxe.org/manual/lf-pattern-matching.html [2]: https://haxe.org/documentation/introduction/compiler-targets.html https://haxe.org/documentation/introduction/compiler-targets...
- xvilka 5y agoThere are also notable Rescript [1], Melange [2], Reason [3], PureScript[4]. [1] https://rescript-lang.org/ https://rescript-lang.org/ [2] https://github.com/melange-re/melange https://github.com/melange-re/melange [3] https://reasonml.github.io/ https://reasonml.github.io/ [4] https://www.purescript.org/ https://www.purescript.org/
- paavohtl 5y agoTypeScript has nothing to do with C#, apart from its creator. The structural type system with explicit nulls, sum types and very powerful generics makes it feel much closer to the ML family of languages than C#, despite using the C-like JS syntax. The teams I've used it in have never really used it to build complex OOP hierarchies or even used classes for anything other than React components, though there are probably many who do.
- zarzavat 5y agoBoth are true. The original TypeScript v1 was a lot more like C#-in-JS and was very class-oriented, however over the years the type system has grown into a mature ML-like structural type system as a side effect of trying to type the wide variety of dynamic JS out there. Anybody who last looked at TypeScript a few years ago and dismissed it needs to have another look.
- bwship 5y agoActually Typescript is it.