type Getters<Type> = { [Property in keyof Type as `get${Capitalize<string & Property>}`]: () => Type[Property] }; interface Person { name: string; age: number; location: string; } type LazyPerson = Getters<Person>; type LazyPerson = { getName: () => string; getAge: () => number; getLocation: () => string; }
Documentation - Mapped Types
When you don't want to repeat yourself, sometimes a type needs to be based on another type.
https://www.typescriptlang.org/docs/handbook/2/mapped-types.html

Seonglae Cho