Last active
November 3, 2020 12:36
-
-
Save AyAyEm/a99e7def3157e62656ae0cbb37515ceb to your computer and use it in GitHub Desktop.
All sort of generics used to extract types from types
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
// Map | |
type MapExtract<MapType> = MapType extends Map<infer X, infer Y> ? [X, Y] : never; | |
// All types of objects | |
type ObjectExtract<ObjectType> = [keyof ObjectType, ObjectType[keyof ObjectType]]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment