TypeScript 5.5, the most recent model of Microsoft’s strongly typed JavaScript variant, has graduated to a launch candidate (RC) stage. The replace, which brings enhancements starting from efficiency and dimension optimizations to common expression checking, lately added help for ECMAScript’s new Set strategies.
The TypeScript 5.5 launch candidate was launched June 6 and may be accessed by way of Nuget or the next command: npm -D typescript@rc
. A beta launch was launched April 25 and the ultimate launch is deliberate for June 18.
For the reason that beta, TypeScript 5.5 added help for the new Set strategies proposed for JavaScript. A few of these strategies, equivalent to union
, intersection
, and distinction
, take one other Set
and return a brand new Set
because the consequence. Different strategies, equivalent to isSubsetOf
, take one other Set
and return a boolean
.
Additionally new within the launch candidate, TypeScript’s common expression checking has been made barely extra lenient whereas nonetheless erroring on questionable escapes which can be allowed solely per ECMAScript’s Annex B. The TypeScript 5.5 (RC) additionally options extra efficiency optimizations, together with skipped checking in transpileModule
and optimizations in filtering contextual varieties that may result in sooner construct and iteration occasions.
TypeScript 5.5 consists of quite a few different enhancements that have been beforehand obtainable within the beta launch. For efficiency and dimension, monomorphization work has been accomplished for the language service and public API. With monomorphism, the editor expertise and construct instruments utilizing the TypeScript API will get sooner, TypeScript’s authors stated. This was the identical work beforehand accomplished for Node and Image objects in TypeScript 5.0 to make sure that they had a constant set of properties with a constant initialization order.
TypeScript 5.5 additionally includes a important discount in general package deal dimension. The disk footprint has been lowered from 30.2 MB to twenty.4 MB, and the packed dimension from 5.5 MB to three.7 MB. As a part of work to allow isolatedDeclarations
, Microsoft has improved how typically TypeScript can straight copy enter supply code when producing declaration information.
TypeScript 5.5 introduces fundamental syntax checking on common expressions. Till now, TypeScript usually passed over most common expressions in code, as a result of common expressions technically have an extensible grammar and TypeScript by no means made an effort to compile common expressions to earlier variations of JavaScript. This meant widespread issues would go undiscovered in common expressions.
With TypeScript 5.5, TypeScript will now infer {that a} operate returns a sort predicate below sure situations. And with management movement narrowing for fixed listed accesses, TypeScript now is ready to slender expressions in for obj[key]
when each obj
and key
are successfully fixed.
TypeScript 5.5 makes API consumption of ECMAScript modules simpler. Beforehand, if a developer was writing an ECMAScript module in Node.js, named imports weren’t obtainable from the typescript
package deal. This has been mounted. TypeScript additionally now helps a brand new @import
remark tag that has the identical syntax as ECMAScript imports.
TypeScript 5.5 additionally provides a transpileDeclaration
API, which is designed to generate a single declaration file based mostly on enter supply textual content. The API is much like transpileModule
for compiling a single file of TypeScript code.
TypeScript 5.5 follows TypeScript 5.4, which turned typically obtainable in March and introduced preserved narrowing inside operate closures.
Copyright © 2024 IDG Communications, Inc.
#TypeScript #provides #help #ECMAScripts #Set #strategies