Created
January 6, 2026 08:08
-
-
Save alaindet/aac4eac4547950fa12c172d5db9ffb12 to your computer and use it in GitHub Desktop.
Prettify TypeScript types in code
This file contains hidden or 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
| /** | |
| * https://www.youtube.com/watch?v=q5DFpyIN5Xs&t=180s | |
| * | |
| * This type helps resolve complex TypeScript types in simpler readable types | |
| * | |
| * - Take a layered complex type (extending multiple types, using generics, inheriting etc.) | |
| * - Create a dummy type via Prettify (type Dummy = Prettify<ComplexType>) | |
| * - Hover with the mouse on the dummy type to see the "resolved" type | |
| */ | |
| export type Prettify<T> = { | |
| [K in keyof T]: T[K]; | |
| } & {}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment