-
-
Notifications
You must be signed in to change notification settings - Fork 567
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
624c331
commit 96f8d68
Showing
3 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,24 @@ | ||
/** | ||
Flatten the type output to improve type hints shown in editors. | ||
@example | ||
``` | ||
import {Simplify} from 'type-fest'; | ||
type PositionProps = { | ||
top: number; | ||
left: number; | ||
}; | ||
type SizeProps = { | ||
width: number; | ||
height: number; | ||
}; | ||
// In your editor, hovering over `Props` will show a flattened object with all the properties. | ||
type Props = Simplify<PositionProps & SizeProps>; | ||
``` | ||
@category Utilities | ||
*/ | ||
export type Simplify<T> = {[KeyType in keyof T]: T[KeyType]}; |