, is now generally available. The new production release features optional chaining, an ECMAScript feature that allows developers to stop running expressions if they encounter a
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 .
--declarationflag, for generating
.d.t.s(declaration) files from source TypeScript files, now can work with the
- Types in
lib.dom.d.tshave been updated. These are largely correctness changes.
Where to download TypeScript 3.7
You can download TypeScript 3.7 or via NPM:
npm install typescript
© 2019 IDG Communications, Inc.
Explore the IDG Network descend