Created
August 7, 2023 02:39
-
-
Save itacirgabral/765d688ee34c25d24384fd3522882e05 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
function youSayGoodbyeISayHello<TGreeting extends 'hello' | 'goodbye'>(greeting: TGreeting) { | |
const returned = greeting === "goodbye" | |
? "hello" | |
: "goodbye" | |
return returned as TGreeting extends 'hello' ? 'goodbye' : 'hello'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment