Skip to content

Commit 55739c1

Browse files
committed
Define type Move based on MOVES array
1 parent 3d56f2b commit 55739c1

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from "react";
22

3-
type Move = "rock" | "paper" | "scissors";
4-
const MOVES: readonly Move[] = ["rock", "paper", "scissors"];
3+
const MOVES = ["rock", "paper", "scissors"] as const;
4+
type Move = (typeof MOVES)[number];
55

66
function getRandomMove(): Move {
77
const index = Math.floor(Math.random() * 3);

0 commit comments

Comments
 (0)