key remapping

Renaming or filtering keys inside a mapped type with an as clause, such as [K in keyof T as `get${Capitalize<K & string>}`].

In more detail

Mapping a key to never removes it from the result. Together with template literal types it generates names such as onUsernameChange from username. It was added in TypeScript 4.1.

Related terms

Taught in

References