Skip to content

Instantly share code, notes, and snippets.

@jonathborg
Last active September 6, 2023 22:22
Show Gist options
  • Save jonathborg/2cab5b058bf4b9c958c4a4b6d21e3b15 to your computer and use it in GitHub Desktop.
Save jonathborg/2cab5b058bf4b9c958c4a4b6d21e3b15 to your computer and use it in GitHub Desktop.
Prettify Typescript types, so we can see deep enough
type Prettify<T> = { [K in keyof T]: T[K] } & {};
class Hello {
id?: number;
name?: string;
created_at?: string;
getFullName() {
return this.name;
}
}
type ItWorks = Prettify<InstanceType<typeof Hello>>;
type Dto = Omit<InstanceType<typeof Hello>, 'id' | 'created_at'>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment