type Option<T> = { [K in keyof T]?: T[K] }
With TS Template Literal Type
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
Get keys of a Typescript interface as array of strings
Creating an array or tuple of keys from an interface with safety compile-time checks requires a bit of creativity. Types are erased at run-time and object types (unordered, named) cannot be converted to tuple types (ordered, unnamed) without resorting to non-supported techniques.
https://stackoverflow.com/questions/43909566/get-keys-of-a-typescript-interface-as-array-of-strings

Seonglae Cho