Microsoft has released TypeScript 4.0, the latest iteration of its hugely popular programming language for building great JavaScript web applications.
The 4.0 release is technically a major milestone with a host of new features. However, according to TypeScript maker Anders Hejlsberg, a technical guy at Microsoft, it’s just the culmination of the work his team has focused on since TypeScript 3.0 was released two years ago.
“It’s funny. We joked with that 4.0, well, it just so happens that it’s coming to 3.9 and literally if you look at our release history … yes, we’re releasing all 10 releases and we’re releasing 3.0 about two years ago,” he said. Hejlsberg told ZDNet.
“But of course in a way a good way to look at it is like what’s happened in those two years since 3.0.”
Hejlsberg says there are several main themes that drive changes in TypeScript, including experience with editors such as Microsoft’s Visual Studio Code Editor, better error messages, and better refactoring.
“We’ve worked a lot on performance, scalability, because people are building really big projects in TypeScript and they still want to have this super-snappy performance on a project with hundreds of thousands of lines of code in it – and that’s not an easy problem at all. to solve. “
Microsoft published TypeScript in 2012 and the language – a superset of JavaScript – has become a top-10 programming language among developers since July, according to analyst firm RedMonk.
RedMonk analyst Stephen O’Grady reckons the popularity of TypeScript is sustainable and was “no fluke” given the ubiquity of JavaScript and the optional security.
Microsoft says that at npm, the popular JavaScript package manager, TypeScript cracked 50 million downloads a month for the first time this month.
One of the performance improvements in TypeScript 4.0 addresses slow startup times for larger projects.
Daniel Rosenwasser of the TypeScript team explains that the culprit is usually a process called ‘project loading’, in which multiple dependencies are resolved. That the team has been working on starting up a share management mode.
“The core idea is that editors can run a lightweight sub-server that only looks at the current files that the editor has opened,” he notes. “This has always been an option for editors, but TypeScript 4.0 expands the functionality on that server to some semantic operations – as opposed to just syntactic operations, which used to be the case.”
Although this limits the available information, it is sufficient to complete basic code and other quick information when an editor is first opened.
According to Rosenwasser, he has seen that machines take up to a minute before TypeScript responds to a file in US code, but the new mode in TypeScript 4.0 cuts down the time for responsiveness to a few seconds.
Among the many other improvements in TypeScript 4.0 are poorer auto-imports to help if auto-import does not work as expected and damages development productivity. One hurdle was that auto-import would sometimes work on packages written in TypeScript.
“TypeScript 4.0 now does a little extra work in editorial scenarios to include a limited number of packages that you specified in your package.json’s dependency field,” Rosenwasser notes.
“The information in these packages is only used to improve car imports, and does not change anything other than type checking. This helps reduce the cost of running through your node_modules catalogs, while still fixing one of the most common issues. we have to listen to new projects. “