The new release, TypeScript 3.4, reduces the time it takes to build software and adds a swathe of other new features.
Microsoft has released a new version of the increasingly popular TypeScript programming language, promising new features and shorter build times.
The language makes it easier to work with classes and modules, thanks to features such as static types, and offers simpler tools for verifying and checking the structure of the code.
SEE: 10 ways to prevent developer burnout (free PDF) (TechRepublic)
The new release, TypeScript 3.4, reduces the time it takes to build software, using a new --incremental flag that can be added when compiling.
Using this flag will save information about the current state of the code and its dependencies when it is compiled. Next time code is compiled using the --incremental flag, TypeScript will use that saved information from the previous compilation to only perform necessary type checks and changes, reducing how long the process takes.
This will result in a slightly longer initial compilation time, followed by faster build times for subsequent compilations.
Using the --incremental flag, Microsoft says it was able to reduce build times for its Visual Studio Code editor, which is written in TypeScript, to approximately one fifth of what it was originally.
In previous versions of TypeScript that type safety would be lost when when passing one generic function to another generic function as an argument. TypeScript 3.4 fixes this issue, ensuring type safety remains in place.
Read-only arrays can also now be defined using slightly simpler syntax, by applying a readonly modifier to an array declaration, for example, readonly string.The readonly modifier can also be applied to tuples, a type of array where the number of elements is known and can be of mixed types, for example, readonly [string, string].
There's also a new way of carrying out type assertion, of specifying the type of a variable to the compiler, using the const keyword, which will also automatically assign readonly properties to object and array literals.
In TypeScript, setting and accessing variables that are defined globally, rather than locally within the current module, can be carried out using the globalThis variable, and TypeScript 3.4 introduces support for type checking on the globalThis variable.
You can read more about the new features and some of the breaking changes the update introduces here.
If you want to get started with TypeScript then check out TechRepublic's guide to the best free resources for learning the language online.
- Getting started with Julia: A list of resources (free PDF) (TechRepublic)
- How to launch a successful developer career (Tech Pro Research)
- Microsoft's TypeScript programming language rising fast, almost makes top 10 (ZDNet)
- Top programming languages to learn in 2019? Developers name their favorites (ZDNet)
- Rust: What it is, why you should learn it, and how you can master it (free PDF) (TechRepublic)
- Getting started with Kotlin: A resource guide (free PDF) (TechRepublic)
- Programming languages and developer career resources (TechRepublic on Flipboard