Created
November 10, 2022 10:39
-
-
Save nkint/0dfbb63dcbc0b68550512361c7f3f0e9 to your computer and use it in GitHub Desktop.
Typescript refine string array
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
// fail silently | |
type Age = "6" | "12" | "24" | "54" | "72" | "84" | |
type AgeOld = Extract<Age, "72" | "84" | "62"> | |
// fail kabum | |
type Age = "6" | "12" | "24" | "54" | "72" | "84" | |
type ExtractOrFail<T, U extends T> = U | |
type AgeOld = ExtractOrFail<Age, "72" | "84" | "62"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment