Created
November 11, 2022 10:31
-
-
Save ampcpmgp/c5cd1cfa1e093c03c66f64f42c952393 to your computer and use it in GitHub Desktop.
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
type _Size = "x-small" | "small" | "medium" | "large" | "x-large"; | |
type USToI<T extends string> = { | |
[P in T]: unknown; | |
}; | |
export type Size<K extends keyof USToI<_Size>> = keyof Pick<USToI<_Size>, K>; | |
// Error! | |
// const size: Size<"small" | "large"> = "medium"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment