import { TachiConfig } from "lib/config"; import { Game, GetGameConfig, GPTString, PBScoreDocument, Playtypes, ScoreDocument, } from "tachi-common"; export function IsSupportedGame(str: string): str is Game { return TachiConfig.games.includes(str as unknown as Game); } export function IsSupportedPlaytype( game: G, str: string ): str is Playtypes[G] { const gameConfig = GetGameConfig(game); return gameConfig.playtypes.includes(str as unknown as Playtypes[G]); } export function IsScore( pbOrScore: PBScoreDocument | ScoreDocument ): pbOrScore is ScoreDocument { // @ts-expect-error thats the test... return !!pbOrScore.scoreMeta; }