TypeScript 7
302 points
4 hours ago
| 21 comments
| devblogs.microsoft.com
| HN
m3h
1 hour ago
[-]
The speed up numbers based on their testing:

    Codebase    | TypeScript 6 | TypeScript 7 | Speedup
    ------------|--------------|--------------|--------
    vscode      | 125.7s       | 10.6s        | 11.9x
    sentry      | 139.8s       | 15.7s        | 8.9x
    bluesky     | 24.3s        | 2.8s         | 8.7x
    playwright  | 12.8s        | 1.47s        | 8.7x
    tldraw      | 11.2s        | 1.46s        | 7.7x
Congratulations to the team for pulling off this feat while doing a responsible migration (looking at you, Bun).

Quick question: How does this affect downstream tools like tsdown and esbuild, which need to build the TypeScript codebase? Can I use TS 7 and current tsdown together?

reply
ksec
1 minute ago
[-]
I know this is about Typescript. But I am wondering if anything happening in Go that will make this even faster?
reply
adamddev1
2 hours ago
[-]
Remember when people would argue about how types weren't worth the effort?

I love TypeScript, if nothing else for how it's been able to popularize types.

reply
kstrauser
2 hours ago
[-]
I don't recall anyone disliking types. Lots of people disliked static typing, or more directly static, explicit typing. For instance, I've been around many conversations over the years where people would say goofy things like they couldn't use Python because it's untyped. That's insane: Python is strongly typed. It's also dynamically typed, which is a different dimension.

There are some genuinely untyped languages, or more typically "stringly typed" ones. I hacked around on AREXX as a youth, where all values are strings, even when they look like numbers. Most of the Unix CLI tools like sed could be, uh, said, to be stringly typed. Most of the "discussions" about typing, though, involved Python and similar dynamically typed languages. I don't think I've ever heard someone claim that weakly typed or untyped languages were great for building large project. I've heard plenty of people claiming that Python couldn't be used to build large projects because it was dynamically typed, or "untyped" as they wrongly described it, which was confusing to those of us using it to build large projects.

reply
_flux
52 minutes ago
[-]
There's a school of thought that consider the term "types" reflect to the properties that exist in programs even before they are run, as in they are a property of the programs themselves, not their state at runtime. This thinking—which is also what type theory talks about—does consider Python untyped: reading a Python program along with its specification, you are not able to assign types to each expression.

But what Python does have is tagging: when you create an object you tag it, and then whenever you operate on those values, you check the tag and maybe raise an exception or not. This is happening at runtime.

Strongly typed and weakly typed do not seem to have good definitions. A good one I've read is that "strong typing describes the typing you like".

It is great though if people go to the same extent as you to define what they are talking about, as this reduces the chances of misunderstandings. But it should not be taken as fact that the definitions you have chosen are the universally accepted ones.

reply
kstrauser
15 minutes ago
[-]
That's fair, and I don't claim that I have the canonically correct answers. My broader claim is that I don't think I've ever heard someone say ugh, I despise that my bucket of bytes has an associated type! The real discussions weren't against types, but against various type disciplines.

For example, I find it highly annoying to have to sprinkle type annotations all over the place when the compiler isn't smart enough to figure out what I mean, in the absence of ambiguity. Like imagine this C code:

  int main() {
      int i = 23;
      auto j = i;
      printf("i = %d, j = %d\n", i, j);
  }
There wasn't a great way until recently (C23, I think?) to say "just make j whatever type it needs to be here and don't pester me with it". Contrast with Rust which is strongly, statically typed but also infers types where it can:

  fn foo1() -> i8 {
      23
  }
  
  fn foo2() -> String {
      "foo2".into()
  }
  
  fn main() {
      let f1 = foo1();
      let f2 = foo2();
      let f3 = f1 + f2;
      println!("Hello, world!");
  }
Here, that bit in "foo2" says "cast this str into whatever type you can infer it's suppose to be". Since it's going to be the return value of a function that returns a String, it must be a String, so Rust casts it to a String. Similarly, the first line of main() says f1 is an i8 because it's assigned to something that returns an i8. f2's a String for the same reason. The f3 line is an error because you can't add an i8 and a String, and Rust can figure all that out without having to annotate f1 or f2.

I love Rust's typing because it's helpful and makes strong guarantees about the program's correctness. I'm not "anti-typing" at all. I'm just not a big fan of languages that make you annotate everything everywhere. Back when such arguments were in fashion, a pre-auto C fan might reduce my whole argument to "you don't like typing, newbie!", which would make me roll my eyes and hand them a lollipop.

FWIW, I think TypeScript's pretty great. I never like JS. I tolerated it, and could use it, but didn't enjoy it at all. TS is fun, though.

reply
jt2190
45 minutes ago
[-]
> Strongly typed and weakly typed do not seem to have good definitions.

Is strongly typed not “I compiler/runtime guarantee the bytes I read adhere to type T”?

reply
dtech
33 minutes ago
[-]
There's a lot of nuance to that statement. Most languages, including e.g. Java or Typescript, would not be strongly typed according to your definition, because their type system is "unsound": there are known cases where the type system does not protect you and the types are wrong. We generally still call these languages strongly typed.

In Typescript this is by design. The most obvious is array variance. Typescript makes them covariant because that's what a lot of sane TS and JS code uses them as, but they should be invariant because you can write to them.

Example:

   const dogs: Dog[] = []
   // A sound type system would error here,
   // but there's too many useful cases where you want to do this
   const animals: Animal[] = dogs 
   animals.push(new Cat())
   animals[0].bark() // runtime TypeError here
reply
arcfour
4 minutes ago
[-]
Okay, so I'm not crazy for thinking that declaring an empty, typed array as `const` and then writing/pushing to it is confusing/feels wrong.

I didn't go to college for software engineering or anything so when I ran into that for the first time I assumed there must have been some good academic reason that was simply beyond me as to why it was done that way.

It turns out that no, it's just as weird to those that do have the formal background, boy am I feeling vindicated ;)

reply
bennettpompi1
21 minutes ago
[-]
I may be missing something, but your example doesn't typecheck?

  class Animal { }
  class Dog extends Animal{
    bark(){return 1}
  }
  class Cat extends Animal{
    bark(){return 1}
  }
  const dogs: Dog[] = []
  const animals: Animal[] = dogs
  animals.push(new Cat())
  animals[0].bark() <<<<< "Property 'bark' does not exist on type 'Animal'."
reply
jt2190
13 minutes ago
[-]
I would have called this “strictly typed” I think, not “strongly”. Maybe my terminology is off.
reply
tgv
21 minutes ago
[-]
Puthon is so strongly typed it lets you assign a string to an integer variable, and or compare the two or add a float and an int. Or multiply an array by a number; something which gets overturned if you use numpy. Python's strong typing mostly boils down to some operator rejecting mixed types.
reply
kstrauser
5 minutes ago
[-]
Python doesn't have variables in the C sense. It has pointers to objects (aka "names"), and the "=" is a pointer assignment operator.

So:

  i = 23  # Create an int(23) object and store its address in i
  i = "foo"  # Create a str("foo") object and store its address in i
i isn't typed. It's a reference to a thing with a type, not a thing with a type itself. It's also pragmatic, in that 99.9% of cases, `1.5 + 2` has a completely obvious meaning. I don't recall ever seeing int+float being the source of a Python bug. Surely someone has, but I haven't.

> Python's strong typing mostly boils down to some operator rejecting mixed types.

Well... yeah. Turns out that plus duck typing is very nearly all most people want out of a type system. I went from Python to Rust and found nearly no difference in how they handle types, except Rust does it at compile time. Judging from the number of people I've seen make the same migration, that seems to be common. And yet no reasonable person makes claims that Rust is weakly typed, even when IMO it's basically Python but enforced at compile time.

reply
sysguest
2 hours ago
[-]
> I don't recall anyone disliking types

> where people would say goofy things like they couldn't use Python because it's untyped. That's insane: Python is strongly typed. It's also dynamically typed, which is a different dimension.

hmm maybe you don't understand type-checking INSIDE IDE, NOT during runtime?

reply
delta_p_delta_x
1 hour ago
[-]
That is what the parent author means. Static vs dynamic typing is along the dimension of when the type is checked, and strong vs weak typing is a matter of how strongly bound names adhere to types. JS, for instance, is super weak here, you can assign a numerical value to something and in the next line re-assign it to a string, an array, or even a function object.
reply
MrJohz
1 hour ago
[-]
That's also true of Python, though, which is traditionally considered a strongly typed language.

I'm increasingly convinced that "strong/weak" has no useful meaning. Some people regularly use it interchangeably with "static/dynamic", others use it to vaguely refer to how much casting exists in a language, or how easy it is to transmute a value of one type into a value of a different type. There is no academic definition at all.

Mostly it gets used as a kind of cheap attack - it's like the meme "it's over, I've portrayed you as the soyjack and me as the chad". Good languages are strong, bad languages are weak, so if I say your favourite language has weak typing, and my favourite language has strong typing, then it's clear that my favourite language must be superior.

In general, I think it's more helpful to just reference the specific language feature you're talking about. Rather than say that JavaScript is a weakly typed language, instead say that there are a lot of implicit type conversations. Rather than say Erlang is strongly typed, say that there is no variable reassignment or shadowing. That way, you avoid the ambiguity about what you actually mean when you talk about strong or weak typing.

reply
nicoburns
11 minutes ago
[-]
Type systems just used to be bad. Anything that forces you to use a class hierarchy to represent an "OR" type (sum types) is painful to work with. Modern languages like TypeScript / Rust / Swift / Kotlin that have sum types are dramatically much nicer.
reply
mamcx
34 minutes ago
[-]
Yeah, I think was algebraic + pattern matching that break the ghetto. Suddenly types were far more useful without going crazy like Haskell!

P.D: Before, the exposure of types was from C++/Java, and special C++ is always a horrible exponent of anything except how make a overly complex language.

Once you see what good application of types look like, is far better sell!

reply
bbg2401
1 hour ago
[-]
> Remember when people would argue about how types weren't worth the effort?

> if nothing else for how it's been able to popularize types.

This is such an odd, javascript dev take.

reply
wk_end
44 minutes ago
[-]
It's maybe a bit of a startup-world, HN-blinkered assessment...but that's where we're talking, isn't it?

Even before JS became the language for everything, there was a good chunk of time - maybe between 2005 and 2015? - when Python and Ruby were dominant in this environment, and this dismissive attitude towards static typechecking was similarly dominant.

Of course in the enterprise space everyone was using Java, and in the systems space or game dev space everyone was using C++. But those worlds get a lot less airtime here.

Plus everyone on HN is a good little pg disciple, and Lisp is dynamically typed. If the One True Language doesn't need static typechecking (though SBCL offers some very helpful heuristics) surely it's not worth it. Right? Right?

reply
dismalaf
13 minutes ago
[-]
> Lisp is dynamically typed.

Ish.

SBCL aggressively infers types wherever possible. It can do dynamic typing with tags of course. You can also write it with 100% static types.

Dynamic typing isn't a defining feature of Lisp style languages (even GC isn't necessary). Some historic Lisps and modern ones are 100% statically typed.

reply
BoingBoomTschak
36 minutes ago
[-]
> Lisp is dynamically typed

"Lisp" isn't a single language. Arguably the language people speak about when they say Lisp without qualifier, ANSI CL, allows conforming implementations (e.g. SBCL) to offer gradual typing, not just heuristics.

reply
adamddev1
1 hour ago
[-]
I'm a Haskell and FP nerd as well. I just meant the argument and the popularity inside the JS/TS world, which is fairly significant. I think the world is a better place because of the widespread adoption of TS over JS.
reply
ajkjk
2 hours ago
[-]
I don't think ... serious people... argued that.

That's a bit hyperbolic so I'm sure I'm wrong, but I have an ace: if you point me at very smart people who argued against types I'm gonna say that they weren't serious. I think it's not possible, if you have the relevant experience of working on both typed and untyped codebases of at least moderate complexity with at least one collaborator, to come away seriously believing that the untyped way is superior (unless you were forced to use a really bad typed language, I guess). And arguing that untyped languages are better without that experience is also not serious, in the sense that anyone can unseriously say anything if they don't care about being well-informed enough to be right.

reply
steve_adams_86
2 hours ago
[-]
I worked with people who would consider themselves serious, and are still in the industry and doing fine. A few have certainly gone on to be more prominent and get paid a lot more than I am—not that it's a perfect measure of seriousness.

In the early days they would often say things like "but we have prop types, why use TypeScript", "why not use JSDoc" (this made no sense at the time), or "it's an exercise in needless complexity". It was really tough to sell them on TypeScript for years.

I think there are developers who are very goal-oriented with a narrow perspective on getting from point A to point B, and their understanding of the process isn't particularly holistic, rigorous, or geared towards external or knock-on factors like maintainability, performance, bugs, etc. They deal with it when circumstances force them to, and no sooner. Defining types is a complete waste of time to someone like that.

These people thrive where teams are primarily expected to just ship things, and in my experience they often hate needing to think about things like types, tests, or code quality beyond running a linter.

So, they're serious people in one school of thought. They contribute meaningfully to projects. I think they're a large constituent of the new class of vibe coders who laugh at you if you look at the code. That's fine, they're doing their thing, and there are more than a few ways to get programs into people's hands. That way just isn't the way I like to.

reply
horsawlarway
2 hours ago
[-]
Look at some of the typing present in MS COM back in the IE5/6 days and we can discuss more. I can honestly tell you - I'll take untyped languages any day of the week over that clusterfuck.

Personally - I also think people really underestimate just how much the tooling around types has improved over the last 20 years.

If I'm having to try to look up the difference between iBrowserInterface6 and iBrowserInterface5 and iBrowserInterface4... (and yes - shit like this really did exist: https://learn.microsoft.com/en-us/windows/win32/api/shdeprec...)

And I have no tooling for autocomplete, and the docs are shoddy, and google is just coming on the scene...

People understandable want to throw their computer out the window.

Types are great. Some forms of them were not.

reply
ajkjk
2 hours ago
[-]
completely agree. but I felt like even then it was clear that types were a good idea and the implementations were not. For instance I started programming on Java 4 or 5 and the types were pretty bad---but still it was obviously the right way to go compared to JS or, god forbid, shell.
reply
horsawlarway
2 hours ago
[-]
> but still it was obviously the right way to go compared to JS or, god forbid, shell.

I just don't think this is true.

Frankly - it's hard to argue this at all (even today) given that JS is the dominate language on the planet, and it lacks types... as does python, which had a reputation for decades as THE language to use to teach new folks to code. Or take PHP which dominated server development for a LOOONG time: also lacks types. Ruby on Rails has a wonderful reputation as the "get shit done" framework: no types.

Types are good for modern software companies, where code size has ballooned up very high (common to work on a codebase with hundreds of thousands of lines) or teams are large (50+ developers) and terrible if you just want to hammer out something that works as a solo dev.

Do I like types today? Sure - the tooling is solid, and I work on large codebases with large teams.

Did I like types as a solo dev at 3 person startup? no.

reply
dprkh
1 hour ago
[-]
> as does python, which had a reputation for decades as THE language to use to teach new folks to code

I am very perplexed by this. I am going through Neetcode's DSA course where he explains what RAM and arrays are, but then he goes on to say something like "but since we are going to use Python, none of this applies." Personally, I learned the most about how software really works from reading The Rust Programming Language. It not only teaches you how to program in Rust, but also how memory works, what a string really is, etc.

reply
TedDoesntTalk
2 hours ago
[-]
Java has a lesson of what can go wrong with types, just as parent says. That example is dates and times. So many types…

And before Java finally settled on what we have today, we had 3rd-party libraries like jodatime that tried to fix it.

I guess it’s in a good state today, but it took a LocalDateTime.MAX to get there. I mean an Instant.MAX. No, I mean an OffsetDateTime.MAX. No, I mean new Date(Long.MAX_VALUE). Oh wait I meant new Timestamp(Long.MAX_VALUE). No, I mean LocalTime.MAX.

I’ll stop now, but i could go on.

reply
nh23423fefe
45 minutes ago
[-]
This isn't a good example at all. Those interfaces are subtypes.
reply
ChadNauseam
2 hours ago
[-]
It's easy to say that now, but it used to be that all mainstream typed languages had absolutely terrible type systems that got in your way as much as they helped
reply
steve_adams_86
2 hours ago
[-]
Absolutely, TypeScript is remarkably expressive in my opinion. The inference and option to bail out with `any` is nice for some teams in some cases, too. They did an excellent job of making it accessible.
reply
mrkeen
1 hour ago
[-]
They're still right here in sibling comments
reply
hombre_fatal
2 hours ago
[-]
> I don't think ... serious people... argued that.

Static vs dynamic typing is no less ubiquitous in online forums over the decades than tabs vs spaces and vim vs emacs.

reply
ajkjk
2 hours ago
[-]
I feel like I see all of these debates far less than I used to? Well I don't see anyone arguing about vim and emacs anymore at all, and spaces have mostly won over tabs, and static typing has mostly won over dynamic, with the holdouts being comparative novices and people who program in less modern environments, like in academia and at smaller companies.
reply
asa400
1 hour ago
[-]
Are the banks and trading firms that use e.g. Clojure/Elixir/Erlang/Python "comparative novices" or "less modern", whatever that means? These are some of the most sophisticated shops I've ever seen, doing some serious software engineering. I like static types as much as the next person and have written probably more Rust and Scala than anything else, but this seems maybe a bit of a gross generalization.
reply
hombre_fatal
2 hours ago
[-]
Yeah, we are definitely past the hey day of these debates, though you can still find them.

e.g. Gradual typing was since added to PHP and Python which ended some debate like how linting tools shut down a lot of whitespace debates.

reply
alserio
1 hour ago
[-]
Spaces over tabs? Since when?
reply
ajkjk
1 hour ago
[-]
i could be wrong, but it was enforced as the default at several places I worked, and most editors now have the option of the tab key inserting spaces to bridge the gap. (I don't care about the actual debate; just, I thought I had noticed it had mostly gone in this direction)
reply
samtheprogram
2 hours ago
[-]
....they did ...and... the camp still exists
reply
ajkjk
2 hours ago
[-]
well, as I said, I don't take them seriously :p
reply
chem83
2 hours ago
[-]
dhh is still not very fond of it. To each their own.

https://world.hey.com/dhh/turbo-8-is-dropping-typescript-701...

reply
tiffanyh
2 hours ago
[-]
> TypeScript just gets in the way of that for me. Not just because it requires an explicit compile step, but because it pollutes the code with type gymnastics that add ever so little joy to my development experience, and quite frequently considerable grief. Things that should be easy become hard, and things that are hard become `any`. No thanks!

That comment is expected by a Ruby enthusiast, which is arguably one of the most dynamic languages in existence.

reply
hvb2
1 hour ago
[-]
Types are a safeguard, they rule out certain errors. So using them is mostly for maintainability, and especially in large codebases and teams that becomes a thing.

I think that comment is clear in that he likes to work alone which for problems of a certain size just isn't feasible

reply
egorfine
1 hour ago
[-]
> Types are a safeguard, they rule out certain errors

I have migrated to TypeScript just about a year ago and it's my third try to migrate to TS from JS during the last decade and finally a successful one. While TS went a long road since the first versions which were incredibly hostile, my rewrite of a large codebase from js to ts revealed exactly zero type-related bugs.

reply
overfeed
20 minutes ago
[-]
eons ago, I migrated a frontend to Typescript and caught a lot of type-related bugs[1]. It was a 5kLoC, fast-moving productized prototype written by a team of 5. I won't ever do dynamic-typed plain Javascript in a team ever again, type-checker is superior to human code-reviews when it comes to catching potential bugs. Then again I prefer codebase stability of clever code or "expressiveness"

1. 20% were type-coercion bugs, 30% were non-boolean values being passed to boolean-named fields (with some overlap with the former). Linters have come a long way, but compile-time type-checking is better in almost every way.

reply
dymk
41 minutes ago
[-]
I'm a Ruby enthusiast - Sorbet is one of the best things since sliced bread to happen to the ecosystem. matz is pushing hard on static typing as part of the standard Ruby ecosystem as well.
reply
aaronvg
1 hour ago
[-]
these painpoints seem moot in a world where AI agents are writing all the code.
reply
overfeed
19 minutes ago
[-]
That world will never be. Humans will always be writing some code, at least for as long as I live and breathe.
reply
austinthetaco
1 hour ago
[-]
I still do argue that for JS. I have yet to see it worth the effort other than making things feel comfortable for former OOP devs coming from other languages.

edit: the downvote button HN is not for disagreeing with comments or unpopular opinions. please dont turn hn into reddit.

reply
dimitropoulos
4 hours ago
[-]
the real story here is an incredible team that managed to simultaneously keep two separate codebases alive for the most advanced type system known to mankind (yeahhh yeahh Hindley-Milner eat your heart out).

huge congrats to the team!

looking forward to the Rust rewrite ;)

reply
hoppp
3 hours ago
[-]
I am not sure a rust rewrite would be meaningful.

Go is great because it's fast to code.It's easy to reimplement typescript in go 1:1 just by looking at the code.

Rust on the other hand would take a lot longer to develop.

Maybe rust is 20% faster than go but overall the increase from typescript with go is good enough.

Maybe rust would yield a 14 times speedup over the 11 times in vscode but go is already good enough to make a huge difference.

reply
afdbcreid
1 hour ago
[-]
A Rust rewrite would have an easy way to expose an API, something they're still debating how to do and deferring to 7.1.

But the team has already choose. They explained their reasoning and IMO it makes sense: they didn't want a rewrite, they wanted a bug-for-bug file-by-file translation. With a borrow checker and no GC, Rust sometimes forces you to structure things differently (especially in a compiler that usually has a lot of circular structures), so it was not worth it.

reply
nicoburns
2 hours ago
[-]
The benefit to Rust rewrite would be integration with the rest of the JS tooling ecosystem which is increasingly written in Rust rather than performance.

It probably won't ever happen though.

> It's easy to reimplement typescript in go 1:1 just by looking at the code.

That's also true of Rust if your codebase is written in a functional style. But apparently TSC had a lot of inheritance, which probably isn't a great fit for porting to Rust.

reply
dimitropoulos
3 hours ago
[-]
jokes aside, have you heard of the Jevons Paradox[1]? it feels like the "induced demand" effect to me with the whole "just one more lane" phenomenon you sometimes can see in roadways. when you increase the efficiency of a thing you thereby expand the set of things it can economically be used for, causing an overall increase in total consumption over time - not a decrease like you'd expect from just having made it much more efficient. "a smaller slice of a much bigger pie is still more pie" or something like that.

in TypeScript's case with the "pie" being compute time, things like HKTs (e.g. hotscript, hkt-toolbelt) that might not have made as much sense in the past suddenly become so much more feasible, but also are the very things that drag that hard-fought efficiency win back down into the mud. is it worth it? library authors will ultimately be the ones to decide the big chunks of that question by virtue of what they ship in their types.

[1] https://en.wikipedia.org/wiki/Jevons_paradox

reply
hoppp
2 hours ago
[-]
Yes, I saw the YouTube video about Jevons paradox from Hank Green yesterday. :)
reply
annjose
1 hour ago
[-]
The Jevon's Paradox. And it is not a paradox :-)
reply
hebrox
2 hours ago
[-]
*The
reply
faefox
2 hours ago
[-]
Fine, the Hank Green.
reply
tancop
1 hour ago
[-]
the difference is with roads you dont get a lot of good secondary effects, one lane is just like the next. benefits are linear with the cost so they balance out. but with typescript and software in general they can be exponential.

fast type inference unlocks brand new patterns that were too slow to be practical on the old checker. at least some of them will turn out to be useful for peoples projects. and its also great for legacy or less complex code bases that will get faster type checking for free.

reply
DonaldPShimoda
4 hours ago
[-]
Most complex, perhaps, but not "most advanced". I don't think there's necessarily a meaningful "correct" choice for that title, but surely one of the proof assistant languages would be a more likely candidate?

(I don't say this to be disparaging of TypeScript's type system, by any means — it's very interesting stuff!)

reply
dimitropoulos
4 hours ago
[-]
good points, let's get negated types and higher kinded types in there then you've got yourself a deal. maybe regex thrown in too for flavor
reply
mejutoco
1 hour ago
[-]
> for the most advanced type system known to mankind

Honest question, what do you mean by this?

reply
samuell
2 hours ago
[-]
Steve Francia (author of Hugo and a bunch of other top Go projects) wrote up some thoughts of Go's fit in the agentic era:

https://spf13.com/p/go-the-agentic-language/

reply
paxys
1 hour ago
[-]
They picked Go after meaningfully considering Rust (and others). I don't remember all the reasons for it but it was detailed in the original blog post.
reply
giraffe_lady
1 hour ago
[-]
Algorithm W is like undergrad level of sophistication. People who like HM more (and I am one) don't like it because it's "advanced" and to some extent exactly because it isn't. It's sound and fast and infers almost everything. TS seems to have one of those features now, so that's nice.
reply
tshaddox
3 hours ago
[-]
> most advanced type system known to mankind (yeahhh yeahh Hindley-Milner eat your heart out)

This TypeScript release is largely about performance. Isn't OCaml still at least twice as fast (and maybe even faster for incremental compilation on very large codebases)?

reply
whilenot-dev
1 hour ago
[-]
I don't think GP was referring to transpilation speed when they wrote "most advanced type system known to mankind".
reply
tshaddox
1 hour ago
[-]
The original poster was referring to the golang port of TypeScript which was done almost exclusively for performance reasons. They weren’t just making an unprompted comparison of two type systems.
reply
miiiiiike
2 hours ago
[-]
After a few years of using Typescript, having to use type annotations and import basic language features like `abc` in Python feels like an absolute slog.
reply
herpdyderp
8 minutes ago
[-]
I'm only seeing a speedup of 4x compared to v6, but I'll take it!
reply
chroma_zone
2 hours ago
[-]
I'm glad the JSDoc type syntax is still getting some focus. It's my favorite way to use typescript in my own projects. Some of the syntax changes will be annoying to update but most of them seem to be for the better.
reply
raddan
2 hours ago
[-]
I'm glad that TypeScript uses JSDoc and not the hideous XML format [1] that Microsoft's other languages use.

[1] https://learn.microsoft.com/en-us/dotnet/csharp/language-ref...

reply
skybrian
2 hours ago
[-]
No TypeScript compiler API yet, but I'm encouraged to hear that they're working on it.
reply
simlevesque
2 hours ago
[-]
It's coming in 7.1
reply
perrohunter
1 hour ago
[-]
For the average developer, does this mean we can simply ugprade to typescriptn 7 and start enjoying the improvements?
reply
herpdyderp
8 minutes ago
[-]
Depends on your tooling. I can't update yet due to ESLint package dependency mismatches. I'll have to wait for all the ESLint plugins to update. There may also be new failures in your code from the v6 to v7 update. I had only a very minor one though in my initial test.
reply
sheept
1 hour ago
[-]
It depends, but for larger projects, you might have tooling for TypeScript that relies on its API, which isn't available in TS 7.0.
reply
lelandfe
1 hour ago
[-]
If you’re continuing to use the previous version in CI, there’s no reason to not use this locally. It’s a tremendous speed upgrade.
reply
herpdyderp
11 minutes ago
[-]
The reason to not use it locally is false negatives or false positives compared to your CI version. Your local tsc will not match the results of your CI tsc.
reply
NetOpWibby
2 hours ago
[-]
The speed-up improvements are incredible, can't wait for this to rollout to Deno. Everything I build uses TypeScript so I'm excited to see just how quick my apps compile.
reply
MoonWalk
49 minutes ago
[-]
I was wondering how this kind of change makes its way into environments like Deno. I'm building a project on Deno too.

As I understand it, Deno provides the "language server" for editors like VS Code. So how does Deno use this... whatever it is from Microsoft? What exactly did they deliver here?

reply
skybrian
35 minutes ago
[-]
Deno resolves import statements in its own way. For example, you can import URLs and JSR packages directly, but the file is usually loaded from Deno’s global module cache. To resolve imports you need to look at the deno.json file and deno.lock file. They also added Deno Workspaces (monorepos) which adds more complexity.

This means you need to plug an import resolver to the TypeScript compiler. Deno uses the TypeScript compiler API, but all the import resolution code is in Rust. I’ve done a partial reimplementation in TypeScript using a coding agent, but there’s quite a lot to it.

I don’t think Deno will be able to upgrade until the TypeScript compiler API is ready.

reply
Exoristos
2 hours ago
[-]
Seeing these graphs of astounding performance gains with less memory requirements makes one wonder, Why am I using server-side TypeScript and not Go?
reply
semiquaver
1 hour ago
[-]
For one, you’re not using TypeScript server-side. Whatever execution engine you are using is executing transpiled or JavaScript.

And yeah, I don’t know who in their right mind is starting projects in TS/JS/python these days except when they don’t have an option.

reply
throw310822
13 minutes ago
[-]
Because you can share types and even modules with your frontend project? Because for applications that aren't CPU-intensive it makes almost no difference? Because you are familiar with it and like it? Because of the humongous amount of libraries?
reply
Scarbutt
39 minutes ago
[-]
Because it’s easier to work with one main language if you can get away with it.
reply
stymaar
2 hours ago
[-]
Performance improvements, yay !

It always surprises me how little complaints there have been on HN about tsc's performance. I do both TypeScript and Rust at work, and I've seen orders of magnitude more comments on the web about how “rustc is slow” than complaints about tsc's performance and it never stops to surprise me given than in practice the later have annoyed me consistently more than the former.

reply
MBCook
2 hours ago
[-]
I didn’t care. Because to me the performance was a cost I was more than willing to pay for giving me sanity in JS land. Knowing you were passing the right types, right number of arguments, etc. Just the quality of documentation you got from having types at all above the nothing we had before was huge.

I love they’ve made it a ton faster. But I never thought about giving it up due to compiler performance.

reply
appplication
2 hours ago
[-]
As a TS dev, it’s probably because we already have such a high pain tolerance and low expectations.
reply
willchen
3 hours ago
[-]
really excited to see this release! i've been using TypeScript for several projects like https://github.com/dyad-sh/dyad which is >250k lines of TypeScript and the speed-up makes things like running typescript check as a pre-commit hook painless

thanks DanRosenwasser and team for building such an awesome tool for so many years!

reply
fishgoesblub
1 hour ago
[-]
Are these performance improvements just for transpiling the Typescript to JS, or actually running programs written in Typescript?
reply
tpetry
1 hour ago
[-]
These are for type-checking. Transpiling takes barely any time.
reply
_pdp_
1 hour ago
[-]
I've been waiting for this for a long long time. Congrats on the release.
reply
terpimost
2 hours ago
[-]
Are there any plans about wasm version?
reply
spankalee
2 hours ago
[-]
Yes, but no official builds yet that I know. This is a really important issue for online playgrounds and IDEs.
reply
jakebailey
2 hours ago
[-]
Hoping to start getting Wasm builds out soon; it's a little unclear what people want when they say "Wasm", because it could mean

- LSP monaco - the API in the browser - the CLI in Wasm for platforms we couldn't build

which muddies the water a bit, but I'm sure we can get it working

reply
raddan
2 hours ago
[-]
I am a little surprised that they rewrote the compiler in Go instead of just compiling the existing compiler to WASM. The linked announcement does not talk about a WASM alternative at all (rewriting a compiler is a risky move!). Does anybody know what the rationale was to do a full rewrite? The article really emphasizes speed, but not much else. Was it Go's concurrency affordances that made the switch worthwhile?
reply
jakebailey
2 hours ago
[-]
The compiler was written in TS; it wouldn't make much sense to compile TS to Wasm, only to have that same code run in the same interpreter as the JS code.

And yes, threading was a big part of it. See also: https://devblogs.microsoft.com/typescript/typescript-native-...

reply
pmkary
52 minutes ago
[-]
Glorious Day!
reply
austinthetaco
1 hour ago
[-]
I'm still not sold on typescript. I've used it off and on professionally for years and it has always just felt like a maneuver to create a safehaven to C# and java devs scrambling to find roles in the modern landscape. Doing purely functional with it is or at least was an absolute chore and so much extra typing happens for extremely obvious variable values that you could derive from the name of the variable. YES you technically can do functional programming (but as i said its a pain) and YES its optional and you dont have to use it everywhere, but try pulling that maneuver on a technical team "lets use typescript where we each feel like it".

I am still of the opinion that well organized and named JS is all that anyone needs and typescript only exists for fresh graduates and fleeing OOP devs.

edit: also the downvote button HN is not for disagreeing with comments or unpopular opinions.

reply
jakubmazanec
1 hour ago
[-]
> I am still of the opinion that well organized and named JS is all that anyone needs

You probably didn't work on any medium or large codebase and didn't have to do a refactor.

> it has always just felt like a maneuver to create a safehaven to C# and java devs scrambling to find roles in the modern landscape

What a nonsense. Perhaps read history of TypeScript and you'll learn why it was created.

reply
austinthetaco
1 hour ago
[-]
You really should just not assume things about people with no reason other than "they dont like the things i like so therefor they must not be experienced". I've worked on plenty of very very large codebases with large teams.

> What a nonsense. Perhaps read history of TypeScript and you'll learn why it was created.

did you? it was created by microsoft, a C# shop, to support their existing workflows around typing and hinting support. The typescript creation team was literally led by the guy who made C#.

reply
jakubmazanec
21 minutes ago
[-]
> You really should just not assume things about people with no reason other than "they dont like the things i like

That's not the reason for my comment. I truly don't understand how after so many years someone "isn't sold" on TypeScript. Sure, you don't have to use it if you don't want to, but if don't see how it's truly essential in current JS development, I don't know what else to assume, other than OP doesn't have enough experience.

> it was created by microsoft

It was created at Microsft, but it was crated by Anders Hejlsberg who, I'm pretty, sure didn't want to just "create a safehaven to C# and java devs", he was actually solving real problems with JS development issues, completely orthogonal You can argue that first syntax was very C/C# inspired, and that Anders also created C#, but that's not what OP meant (or at least how it read).

reply
MiTypeScript
4 hours ago
[-]
sub-1day-first-frame-of-DOOM LFGGGGGG
reply
blurb2023
2 hours ago
[-]
finally it uses a normal language backend =)
reply
m_ke
48 minutes ago
[-]
After running out of Fable credits in a day on my max plan I started looking around for ways to trim down my token usage and came to the realization that all of the type spaghetti that opus wrote is probably eating up like 50-70% of my tokens.

A clean django project is probably 3-4x less code than the equivalent TS based service.

It made me consider dropping strict mode and defaulting to js for most simple things.

reply
jw1224
42 minutes ago
[-]
Interesting, I've come to the opposite conclusion: a lack of types (or types that are only weakly enforced) costs me significantly more tokens in the long-run to maintain, and makes it far too easy for models to silently introduce bugs.

I run all my projects now in TypeScript with the strictest possible settings, including disabling `ts-ignore` markers.

(This would drive me absolutely insane, but my agents get over it pretty quickly!)

reply
kodama-lens
36 minutes ago
[-]
In a world where code generation is cheap, why use untyped languages? Types add confidence, stricter interfaces, and most likely a better runtime performance.
reply
m_ke
25 minutes ago
[-]
With agentic coding the costs of tokens compound with each message / tool call and etc. Having to load in and update large files makes things slower and way more expensive.

Databricks actually just posted some of their own benchmarks on how harness alone impacts costs https://www.databricks.com/blog/benchmarking-coding-agents-d...

simple things like passing more file context, model having to explore the code base at start of each session, writing comments or markdown docs ends up increasing, running into test / build issues can 3-10x your costs.

PS: my code is still mostly TS and rust but I'm considering moving some of my annotations into .d.ts files and having them generated from runtime types (ala MonkeyType).

reply
IceDane
40 minutes ago
[-]
Why not just do like.. actual engineering, and stay in control of what the LLM builds?
reply