satisfies An operator that can catch errors.
satisfies, developers can validate that the type of an expression matches some type without changing the type of the result of the expression. This operator can be used to catch possible errors, such as checking that an object has all keys of a certain type, but nothing more.
Also, in TypeScript 4.9,
in Operators are now more powerful at filtering types that don’t list properties.Instead of leaving them alone, the language intersects those types
TypeScript 4.9 also has better checks on methods.
in Used to ensure that a valid property key is used.
npm install -D typescript
Other new features and improvements in TypeScript 4.9:
- File watching is powered by file system events by default. It only reverts to polling if the developer fails to set up an event-based watcher.This should provide a less resource intensive experience at runtime
–-watchmode, or in a TypeScript-powered editor such as Visual Studio Code or Visual Studio.
AwaitedA type that unwraps the passed Promise-like type.This means it will return the right more often
Promisetype, but that improved type might break existing code if you were expecting
- TypeScript errors out on direct comparisons with NaN values and suggests some variations
- TypeScript now supports an upcoming feature in ECMAScript called auto-accessors. It is declared like a class property, except that
- To improve performance,
forEachChildfunction has been rewritten to use function table lookups instead of switch statements across syntax nodes. We’ve also optimized the way TypeScript retains information about types in true branches of conditional types.
- To optimize the replacement type,
SubstitutionTypeThe object no longer contains substitute properties that represent valid alternatives.Instead, they have
typescript 5.0 is scheduled for a beta release on January 24, 2023, with a release candidate set for February 28th and a production release expected to arrive on March 14th. TypeScript 4.8 shipped on August 25thbrings accuracy and consistency improvements, and file watcher fixes.
Predecessor TypeScript 4.8 shipped on August 25thbrings accuracy and consistency improvements, and file watcher fixes.
Copyright © 2022 IDG Communications, Inc.
https://www.infoworld.com/article/3674814/new-typescript-operator-finds-coding-mistakes.html#tk.rss_all New TypeScript operator finds coding mistakes