TypeScript 6.0 beta lays the foundation for shifting the codebase from JavaScript to Go
Microsoft has announced a beta for TypeScript 6.0, which will be the last release of the language using the JavaScript codebase.
The company announced last year that it was working on a native implementation of TypeScript written in Go, in an attempt to improve editor startup time, reduce build time, and cut down on memory usage.
“Since the inception of TypeScript more than a decade ago, TypeScript has been written in itself,” said Anders Hejlsberg, lead architect of TypeScript, back when the plan was first announced. “That’s brought a lot of benefits, but it’s also consistently brought some challenges, in particular around performance and scalability. The JavaScript runtime platform is really optimized for UI and browser usage, and not so much for compute intensive workloads like compilers and system level tools.”
Writing TypeScript in Go will allow it to leverage the speed of native code and shared-memory multi-threading, Daniel Rosenwasser, principal product manager at Microsoft, explained in a new blog post.
According to him, TypeScript 6.0 will lay the foundation for TypeScript 7.0 and beyond, and act as a bridge from TypeScript 5.9 and 7.0.
Many of the features available in this beta are designed to support this transition. For instance, in the compiler, strict is now true by default, module defaults to esnext, target defaults to current-year ES version, noUncheckedSideEffectImports is now true by default, and libReplacement is now false by default.
Additionally, rootDir now defaults to the directory containing the tsconfig.json file, rather than its location being inferred based on the common directory of all non-declaration input files.
The types field of compilerOptions also now defaults to an empty array, []. “ This change prevents projects from unintentionally pulling in hundreds or even thousands of unneeded declaration files at build time. Many projects we’ve looked at have improved their build time anywhere from 20-50% just by setting types appropriately,” Rosenwasser explained.
TypeScript 6.0 also introduces several deprecations, including the target: es5 option; —downlevelIteration; --moduleResolution node; amd, umd, and systemjs values of module; --baseUrl; --moduleResolution classic; --esModuleInterop false and --allowSyntheticDefaultImports false; --alwaysStrict false; --outFile; legacy module syntax for namespaces; asserts keyword on imports; and no-default-lib Directives.
Developers can ignore these deprecations in TypeScript 6.0 by setting “ignoreDeprecations”: “6.0”, but 7.0 will not support any of the deprecated options.
According to Microsoft, these changes were design in accordance with several shifts in how developers write and ship JavaScript since TypeScript 5.0 was released.
While much of the work on this release is on setting things up for TypeScript 7.0, the team did also introduce some new features, which are detailed in the company’s blog post.
Microsoft says that TypeScript 6.0 is now considered “feature stable” and no more new features or breaking changes will be added. The TypeScript team will spend the next several weeks addressing issues reported in the codebase while continuing to work on TypeScript 7.0.
“As to the schedule between TypeScript 6.0 and 7.0, we plan for 7.0 to be released soon after 6.0. This should help us keep some continuity in our development with the chance to address issues sooner after the release of 7.0,” Rosenwasser said.
The post TypeScript 6.0 beta lays the foundation for shifting the codebase from JavaScript to Go appeared first on SD Times.
Tech Developers
No comments