4 ms·
I’m not a huge JavaScript developer as I prefer to code things in native languages wherever possible but TypeScript is amazing and has brought much-needed sanit
by ComputerGuru 8y ago
I’m not a huge JavaScript developer as I prefer to code things in native languages wherever possible but TypeScript is amazing and has brought much-needed sanity to the world of interpreted scripting languages. With Hejlsberg at the helm it has gained some incredible type-related features that even traditional strongly-typed dynamically inferred languages haven’t been able to find elegant syntax for.
It started off taking language queues and inspirations from C# and other languages and is now at the point where they are the ones copying back. Impressive stuff, and it’s really come a long way since 1.0 which was so much more awkward to use.
- always_good 8y agoFWIW, the Redditism of pointing out that you're not in fact a die-hard supporter of something doesn't make your praise any stronger. It always feels like cheap rhetoric since you can prefix anything you say about anything with that, as many people do.
- sremani 8y agoThe only thing that feels cheap here is your unnecessary contextual annotation without adding any proper value.
- GordonS 8y agoI'm mainly a C# guy, and have never been a fan of JavaScript (although I concede it has improved dramatically over the last few years). I've never liked front-end development, but my first Typescript project was something of a revelation for me - a familiar syntax, static types, async/await, automatic fields via some ctor sugar, and a great type system! I really like the way it blends aspects of C# with JavaScript and F# - if you didn't known it had Hejlsberg at the helm, you could easily guess.
- sbjs 8y agoI think you just solved the mystery I was wondering about... I bet Microsoft's endgame here is to create a new platform. Think about it, they're actually succeeding in getting types added to every single JS package out there, slowly but surely. Eventually, there'll be no more need for the `any` and `unknown` types, which I bet are just transitional. Once all JS in the world is completely and fully typed, they will have enough type information to create a blazingly fast alternative compiler and (minimal) runtime, even faster than C#, maybe even rivaling C or C++. I mean they literally put the guy who made C# in charge of TypeScript and had him working on this language for several years now. I have no idea how they'll avoid the same mistakes they made with UWP, but I honestly bet they're making a new platform even right now as we speak, and that they're going to unveil it in a year or two.
- ballenf 8y agoTruly ignorant question here, what is a 'platform' in this context? (Or what could it be?)
- nine_k 8y agoA VM that replaces (or supersedes) JavaScript in the browser (and elsewhere).
- mattferderer 8y agoSome believe that is the path of Web Assembly. That's still got a long ways to go though. In the meantime MS is working on compiling its languages to Web Assembly. It's most popular experiment is Blazor.
- breatheoften 8y agoI think one of the reasons typescript has been able to get so good so fast as by having types _not_ control execution. Traditional type systems have a whole lot of requirements that arise because of the need for types to offer the currency that drives the code generation (and optimization) processes. I’m hoping the eventual way that typescript style typing helps with perf is by presenting new compilation modes that make it possible to detect at runtime places where the code executed (at runtime) might not be providing the performance that could be expected by the types (because of a lack of runtime deoptimization or lack of ability for runtime to specialize in the circumstances presented during the program’s execution). I think that could be a pretty powerful way forward — and very pragmatic given that the vast majority of code in any code base doesn’t need to be particularly fast ... I think what’s needed in this domain are (1) powerful tools to help maintain correctness (2) a smooth way to find and fix performance issues where they occur — and ideally by being able to write those fixes in the same language. I think those more useful features for a web scale language than a language that bends over backward in terms of expressivity to make “everything fast” ...
- Nelkins 8y agoAha! A new platform, brilliant! And better yet, it could be a common runtime, for different languages to inter-operate! But what would they call it?! ;)
- igouy 8y agotypo "language queues" — "language cues"
- tomjen3 8y agoIt is Anders Hejlsberg, who is in charge of both projects (or was in charge of C#) so the similarity is not that strange. I have to say though that I like Typescript so much, precisely because it has such a great type system.
- mixmastamyk 8y agoWhat does a "great type system" mean?
- tomjen3 8y agoWhat does a great painting mean? It is hard to explain, you will have to go check it out on your own :)
- nojvek 8y agoBeing able to define the type of something with a lot of flexibility. Most languages only allow one kind of type. Typescript can have unions or types from intersections or extended types. It has an innovate set of type algebra inspired from different languages over time. Not only that but once you have types for inputs, it can infer a lot of things. Augment the humans with almost magical code completion ability because it can reason using types and static code. It helps catch a whole bunch of issues in a dynamic language like Javascript. I’d say Typescript makes javascript fun and scalable to use.