Hello everyone! Today, before our eyes, a truly significant event for web development in general is taking place. Just a couple of days ago, a project from Microsoft for the TypeScript language was put into the public space. And this is really important!
๐ What's new?
First of all, the original TypeScript compiler under the hood is moving in the new version 7 from JavaScript to Go. That is, there will be conditionally TypeScript 6 (JS) and TypeScript 7 (Go). This was done mainly because of the scaling problem when used in very large projects, but also, of course, because of the speed.
Today, the new project shows a 10x increase in some tests, which makes it super promising. The main thing is, of course, the code editor. If we are talking about speed, then if you do not have some Intel Core i9-13900K processor, where in principle everything is irrelevant, but a slower one, or a laptop, then you have all encountered the fact that your project in VS Code starts up, well, literally for a very long time. That is, if it is one file - okay, but if we are talking about a modern Next.js application with 100 pages and 1000 files, then the laptop just glitches like an old washing machine until it starts up.
So version 7 just minimizes all this horror and with new versions of VS Code will allow you to launch your projects faster.
โ About Go
Of course, it's unusual to talk about Go in the context of web development, because it's usually related to the backend, but it's still worth it now. Why did you choose Go and not another language, like Rust or something else?
Here is a short list of why Go was chosen:
"By far the most important aspect is that we need to keep the new codebase as compatible as possible, both in terms of semantics and in terms of code structure...Idiomatic Go strongly resembles the existing coding patterns of the TypeScript codebase, which makes this porting effort much more tractable."
"We also have an unusually large amount of graph processing, specifically traversing trees in both upward and downward walks involving polymorphic nodes. Go does an excellent job of making this ergonomic, especially in the context of needing to resemble the JavaScript version of the code."
These are direct quotes from here, if you want to know why Go, you can read the full text.
๐ Problems with the new version
A new version is always good, but there are also pitfalls that you should know about so as not to make mistakes in your projects:
Modest code base - This project has literally just been presented to the public, so in terms of code base parity with older versions 5.8, 5..., it is clear that it is not comparable. That is, if you want to learn something new about version 7, if you have some kind of bug, or something similar, then ChatGPT will not answer you, and you will not find information on StackOverflow. You will be considered a discoverer and your duty is to record on the Internet what you have found. This is, of course, cool, but when it comes to projects with large budgets, it is worth understanding that these are still risks, because developers can literally sit for several hours just to infer the type. But, it is also clear that this is a reserve for the future, like Next.js in 2021.
Go - Yes, this can be considered both an advantage and a disadvantage. Just imagine how much code, modules and other stuff was made specifically for JavaScript, and now the language under the hood of the compiler is changing. Accordingly, the problems that were with Go are transferred to web development. Many web developers are not even aware (I hope not) what kind of programming language it is, but its implementation inevitably entails inconsistencies and crutches.
๐๏ธ Conclusion
From my point of view, this is really something new and cool, because the speed of the program has always been of primary importance to me. I like the fact that web development does not focus entirely on JavaScript, which is everywhere now, but also on other languages โโthat can bring something new. It is clear that everything is around JS, HTML, because it is a standard, but still, when we talk about variability, everyone will remember the backend, that is where everything is, but now there is something to discuss on the client. Therefore, even with all the shortcomings of the new version of TypeScript, I think that it should be downloaded and it should be tried, developed. Imagine, before our eyes history is being made, where millions of developers will develop this, a bunch of new bugs with Go and features, typical inconsistencies and other similar things. But, it is cool!
๐ฌ What do you think about this? It will be interesting to read!
Thank you very much for reading the article!
Top comments (20)
I have two questions about Microsoft's announcement.
Was anyone else surprised when they said "10x faster"? Usually when you say a programming language is fast, you mean its code executes quickly. But Microsoft's announcement says its build times will be 10x faster. Was it just me, or is that an odd way to express the speed of the language?
That's my other question. The announcement says TypeScript's native implementation "will drastically improve editor startup..." The first line in the announcement describes them as "next steps we're taking" and the conclusion promises "in the coming months weโll be sharing more about this exciting effort." (At one point it even talks about what we'll see in TypeScript 7 "upon release.") So.... This isn't here yet, right? This is something they're still working on?
This case doesn't apply to TypeScript, as it doesn't provide an execution environment. The goal of TypeScript as an executable is to compile code to JavaScript.
So, with a 10x increase in performance they probably mean just that. We can reasonably expect improvements in type resolution and inference, and probably also in the startup and execution time of the language server.
Most likely, as for the editors, this is not yet the case. They only announced a more or less working version, but it still needs to be finished.
As for the speed, most likely, the maximum of JavaScript implementation was approximately reached here, it was necessary to switch to something faster. It is clear that in regular C as one of the fastest, if not the fastest, you can't do this, because literally everything has to be rewritten from scratch, they took something in this style and similar to js, โโas it seems to me.
They want to release it properly by the end of 2025, maybe.
Thanks for the clarification. I guess I was expecting Microsoft to say "a 10x faster TypeScript compiler" in their headline (and not "a 10x faster TypeScript"), since as you point out this is all about the compiler and not the language.
It does look like you can build and run the Go code now in the new working repo Microsoft links to in their announcement. (So not formally released, but still available now.)
I thought the purpose of TypeScript was to give us a better JavaScript. Mostly for browser related applications.
How will Go help in browsers?
TypeScript will compile code into JavaScript faster.
Typescript compiler doesn't run in the browser, it runs on your machine, compiling typescript code into JavaScript, which then runs in the browser.
I know that. So now we will put the transpiled go code in the browser?
The compiler is what is changing from JavaScript to Go. Not the compiled code. That will still be JavaScript.
We're changing from an electric oven to a gas oven. We didn't stop baking bread. It just will be faster now.
Ah, so that's why TypeScript is written everywhere
Exactly
Good explanation
Thanks!
By the way, you can download typescript like this:
Moving to Go is definitely an interesting move! But donโt you think Rust could have been a strong contender as well? Especially with its high performance in memory management and handling large-scale projects. ๐ค
Either way, Iโm really excited to see how developers adapt to these changes, especially in Next.js and other large projects
This is a perfect case where Rust is not the ideal fit for the job. They are 'porting' the compiler not 'rewriting'. Go shares very similar syntax as typescript and it is also very performant so it would be easier for them to port the code base. Rust syntax and programming style heavily defers from that of typescript's. If the compiler was to rewritten, then Rust would be the perfect choice.
Great content, keep it up :D
TypeScript 7 brings a 10x speed boost with smarter type-checking and enhanced performance. Inspired by the Go language, it streamlines dev workflows. Whether coding a Dreisatz Rechner or scaling apps, TS7โs optimizations make development faster and smoother.