Skip to content

Instantly share code, notes, and snippets.

@Woodz
Woodz / generic-rename-type.ts
Created June 30, 2023 07:32
Experimenting with how to strongly type field renames
interface Foo {
a: string;
b: number;
c: {
a: boolean[];
}
}
type RenameAToZ<T> = T extends { a: any } ? {
[K in keyof Omit<T, 'a'>]: RenameAToZ<T[K]>;