fix: Use type for type imports and literal types
Refactor `types.ts` to use `as const` for `GamePhase` and explicitly define the `GamePhase` type. This improves type safety and clarity. Additionally, update imports in other files to use `type` for type-only imports, further enhancing type safety and preventing potential runtime issues.
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
export enum GamePhase {
|
||||
LOBBY = 'LOBBY',
|
||||
COUNTDOWN = 'COUNTDOWN',
|
||||
QUESTION_DISPLAY = 'QUESTION_DISPLAY',
|
||||
BUZZER_OPEN = 'BUZZER_OPEN',
|
||||
ADJUDICATION = 'ADJUDICATION',
|
||||
ANSWER_REVEAL = 'ANSWER_REVEAL',
|
||||
LEADERBOARD = 'LEADERBOARD',
|
||||
FINAL_STATS = 'FINAL_STATS'
|
||||
}
|
||||
export const GamePhase = {
|
||||
LOBBY: 'LOBBY',
|
||||
COUNTDOWN: 'COUNTDOWN',
|
||||
QUESTION_DISPLAY: 'QUESTION_DISPLAY',
|
||||
BUZZER_OPEN: 'BUZZER_OPEN',
|
||||
ADJUDICATION: 'ADJUDICATION',
|
||||
ANSWER_REVEAL: 'ANSWER_REVEAL',
|
||||
LEADERBOARD: 'LEADERBOARD',
|
||||
FINAL_STATS: 'FINAL_STATS'
|
||||
} as const;
|
||||
|
||||
export type GamePhase = typeof GamePhase[keyof typeof GamePhase];
|
||||
|
||||
export interface PlayerStats {
|
||||
correctAnswers: number;
|
||||
|
||||
Reference in New Issue
Block a user