Loading...
type Prop<T> = T extends `get${infer R}` ? R : never;
type P = Prop<'getName'>; // 'Name'type Prop<T> = T extends `get${infer R}` ? Uncapitalize<R> : never;
type P = Prop<'getName'>; // 'name'Uncapitalize lowercases the first letter, so the getter name maps back to the property 'name'.
string stays string.Uncapitalize changes only the first character; Lowercase changes the whole string.
No, it only transforms the type. Lowercase the first character of the value yourself.