Live data from Hacker News

TypeScript 5.0

devblogs.microsoft.com

171–180 of 332 posts

Re: TypeScript 5.0

#171

Earlier quoted context omitted.

I'm curious what criteria you used to pick Flow vs. Typescript.

I remember doing a head to head comparison between Flow and Typescript back in 2015 or sometime around then, and flow came out top at the time. Main pull for flow for me was strict null checking and disjoint unions, which typescript lacked at the time. About a year later typescript got strict null checks and discriminated unions, and from that point on typescript just kept improving, the community type defintiions ke…

Typescript in strict mode doesn't allow excess properties in an increasing number of situations. Typescript is still more structurally typed than nominally typed so there's no easy way to opt-in a specific type to stronger checks than average. The ergonomics are obviously different between Typescript and Flow. There are existing practical workarounds today to get more "nominally exact" types in Typescript such as using "brands" of various sorts (the most common is adding a private unique symbol to a type), though the ergonomics of using such branded types is also its own sort of awkward.

Re: TypeScript 5.0

#172
post #87

Earlier quoted context omitted.

I used to think so too, until I tried Rust. By comparison, JavaScript (and by extension, TypeScript) is still lacking fundamental features and the library ecosystem situation is pretty bad. I wish there was a modern language that took all the good non-manual-memory-management things from Rust and added a GC and some immutable data structures. Error handling, enums, macros (with compile_error! / diagnostics API), trai…

Have you tried C#? Sounds like it would fit your needs perfectly, additionally benefitting from a huge ecosystem behind it.

C# doesn't have algebraic data types and pattern matching though, right? I'm not the same person, but at least for me that's one of the big advantages of Rust, and it's one of those features that outside of Rust you only really find in ML-family languages. I know it's possible to simulate it partially using sealed classes in some languages, but that's always seemed like a lot of boilerplate in comparison.

Re: TypeScript 5.0

#173
post #56

Your regular reminder, that it’s just a regular release, since typescript don’t follow semver. After 4.9 goes 5.0

Why have decimals at all then? Just increment by whole numbers every release. It's the exact same thing except with the decimal moved over to a sensible place.

Re: TypeScript 5.0

#174
post #124

Earlier quoted context omitted.

Is there a reason for this? Why even have the decimal if 4.9 -> 5.0 is just as significant as 4.8 -> 4.9. Just make it v49 -> v50 and remove the ambiguity. What am I missing?

One downside to having a version 4.10 is that some sorting algorithms put this release between 4.1 and 4.2 and not after 4.9. But yeah, they should just go ahead and follow semver from now on.

Python went from 3.9 to 3.10 some time ago. And many people with YAML-based pipelines found out that 3.10 is turned into decimal 3.1, and ended up trying to build with an ancient version, because quoting was optional (and because YAML is a terrible language).

Re: TypeScript 5.0

#175
post #93

I wonder when will be Typescript done, there is only so much that one can do adding a type system to JavaScript, without starting to become C++ like complexity language, which arguably already is.

It's already there. There are less and less new type features, all they do is implement any new ECMAscript proposals that made it to stage 3 at least. If you look at the changes of this and the last few releases, it's mostly internals, tooling and handling and other non-type things. Decorators are in TS 5 now because they made it to stage 3 last year. They have to follow the other current and future ECMAscript propos…

Meanwhile tsconfig.json keeps getting bigger, with combinatorial explosion of Haskel like feature sets, regarding how a source file is to be understood.

At least we get lots of opportunities for interview questions.

Re: TypeScript 5.0

#176
post #166

Earlier quoted context omitted.

Have you tried C#? Sounds like it would fit your needs perfectly, additionally benefitting from a huge ecosystem behind it.

How does the verbosity in C# compare to Java's? And are big C# codebases littered with annotations and "dependency inversion" Java Spring boilerplate-y crap? I ask because I have never delved into C# only heard it's Microsoft's Java. And I am no fan of the original Java at all so C# gives me pause.

C#11 defaults to nullability and has top-level functions giving it a big advantage over Java. The idiomatic Pascal case takes some getting used to but it's worth it.

Re: TypeScript 5.0

#177

Earlier quoted context omitted.

> I have a strange take - I think Typescript types are better most other languages, including Java, C++ and Go. It's strange since TypeScript is adding types to a weakly typed language. Typescript types don't exist at run time, at all. So it's easy to be better when your language is merely about static analysis as it will not enforce any sort of type system during runtime. Java, Go or C++ have different constraints.

that's a false equivocation in the sense that you just moved the goalposts by defining what "runtime" means. There are no types whatsoever as far as processors are concerned. No types in assembly Not for Go or Java, not for C, and not for Rust. All you gotta do is keep compiling.

Runtimes exist above processors, you know.

Here's types existing at runtime: https://go.dev/play/p/rc--yVzJ9bt

Re: TypeScript 5.0

#178
post #116

Earlier quoted context omitted.

And it doesn't hurt that the TypeScript team is so great. We've seen some public apologies from the Flow team on this topic so I don't feel like I'm talking behind anyone's back if I say they ended up truly not being up to the task of being what TypeScript is today.

Any links to their apologies? I don't understand why they apologized.

I presume they're referring to https://medium.com/flow-type/clarity-on-flows-direction-and-...

Re: TypeScript 5.0

#179
post #125

I wish MS will fork Typescript into a new language altogether that transpiles to JS or compiles to WASM. In that case, they can remove all JS weirdness from it, simplify it, add a proper standard library, and add other good parts from other (especially functional) languages to it. My wish list for such a language (in addition to what is already in Typescript), in no particular order: - Generic object literals (Why sh…

If you're breaking backwards compatibility then my number one request is replacing UTF-16 with UTF-8 for strings and nothing else comes close.

You're asking Microsoft to undo a very Microsoft oddity that Microsoft seems to use just about everywhere. Good luck!

Re: TypeScript 5.0

#180

Earlier quoted context omitted.

If s is a non-integer number

I mean, that could be changed. Currently: either string OR number Possible: either string | number OR just number

"string | number | number" is just "string | number" to Typescript.
Post reply on HN