|TypeScript 4.1 Adds Temporal Literal Types|
|Written by Kay Ewbank|
|Monday, 23 November 2020|
TypeScript has been updated with new checking flags, editor productivity updates, and speed improvements, alongside new features including support for temporal literal types.
"Some of the real value comes from dynamically creating new string literals. For example, imagine a makeWatchedObject API that takes an object and produces a mostly identical object, but with a new on method to detect for changes to the properties."
Support has also been added for key Remapping in mapped Types. Mapped types can create new object types based on arbitrary keys, but until now could only produce new object types with keys that you provided them. TypeScript 4.1 now allows you to re-map keys in mapped types with a new as clause. This will enable developers to create new keys, or filter out keys, based on the inputs.
Another improvement is support for checked indexed accesses to tighten the rules for the use of accessed property that have not already been listed.
Elsewhere, TypeScript 4.1 supports React 17’s upcoming jsx and jsxs factory functions through two new options for the jsx compiler option, and adds editor Support for the JSDoc @see tag meaning developers can use functionality like go-to-definition in a dotted name following the tag.
or email your comment to: firstname.lastname@example.org