After exploring the concept of Key Remapping in TypeScript, as shown in this guide, I am wondering if there is a way to automatically inherit property annotations from the original Type?
type Prefix<Type, str extends string> = {
[Property in keyof Type as `${str}${Capitalize<string & Property>}`]: Type[Property]
};
interface Person {
/** This is the name. */
name: string;
/** This is the age. */
age: number;
/** This is the location. */
location: string;
}
interface A extends Prefix<Person, 'alpha'>, Prefix<Person, 'beta'> {};
When hovering over A.alphaName
, is it possible for the editor to display
(property) A.alphaName: string. This is the name.
by default and only update annotations where necessary?
Appreciate your insights.