Created
December 27, 2023 16:30
-
-
Save DouglasdeMoura/b801a47199cdd819cec8962be2cf11e6 to your computer and use it in GitHub Desktop.
Jokenpo in TypeScript
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 Moves = "rock" | "paper" | "scissors"; | |
type RockPaperScissors<_Move extends Moves> = _Move extends "rock" | |
? "paper" | |
: _Move extends "paper" | |
? "scissors" | |
: "rock"; | |
type Result = RockPaperScissors<"rock">; // expected to be 'paper' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment