Created
November 21, 2023 10:05
-
-
Save martinhj/72b441be2154881533999a14a4c07d01 to your computer and use it in GitHub Desktop.
Matt Pocock's `Prettify` TypeScript helper type
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
/** | |
* A TypeScript type alias called `Prettify`. | |
* It takes a type as its argument and returns a new type that has the same properties as the original type, | |
* but the properties are not intersected. This means that the new type is easier to read and understand. | |
*/ | |
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