Last active
September 6, 2023 22:22
-
-
Save jonathborg/2cab5b058bf4b9c958c4a4b6d21e3b15 to your computer and use it in GitHub Desktop.
Prettify Typescript types, so we can see deep enough
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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