Created
March 10, 2023 17:29
-
-
Save EduardoRFS/32d452c20892727e24892dba5ea5e4ec to your computer and use it in GitHub Desktop.
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
const f = < | |
A extends "number" | "string", | |
T extends A extends "number" ? number : A extends "string" ? string : never | |
>( | |
_: A, | |
x: T | |
) => x; | |
const a = f("number", 1); | |
const b = f("string", "b"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment