A beta version of TypeScript 3.7 was released October 1, with general availability planned for early November. A release candidate is due before then.
Optional chaining uses a new
?. operator for optional property accesses. Also included are two other operations: optional element access, for accessing non-identifier properties such as numbers and arbitrary strings, and optional call, for conditionally calling expressions if they are not
Other highlights of TypeScript 3.7 include:
- A nullish coalescing operator, an upcoming ECMAScript feature that is paired with operational chaining, that provides a way to fall back to a default value when working with
undefined, via a
- Improved support for
never-returning functions. The intent of the
neverfunction is that it never returns, indicating an exception was thrown, a halting error condition occurred, or a program exited.
- Assertion signatures, which model assertion functions. The first assertion signature models the Node
assertfunction, ensuring that whatever condition is being checked must be true for the remainder of the container scope. Also,
asserts conditionstipulates that whatever is passed into the
conditionparameter has to be true if the
assertreturns. Another type of assertion signature does not check for a condition but tells TypeScript that a specific variable or property has a different type.
- The ability to add
// @ts-nocheckcomments at the top of TypeScript files to disable semantic checks.
- When opening a project with dependencies, TypeScript will use source
.ts/.tsxfiles instead of project references, to provide a better editing experience.
- More recursive type aliases.
Where to download TypeScript 3.7
You can download the TypeScript 3.7 beta through NuGet or via NPM:
npm install typescript@beta