From 9693f867bc962b7c17b7581339d7fd11ce215819 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Sat, 26 Apr 2025 20:15:16 +0300 Subject: [PATCH] Enable erasableSyntaxOnly TS flag --- app/features/theme/core/provider.tsx | 11 ++++++----- app/modules/brackets-model/other.ts | 15 ++++++++------- tsconfig.json | 1 + 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/app/features/theme/core/provider.tsx b/app/features/theme/core/provider.tsx index 0b6fa5a3b..bc9d9466e 100644 --- a/app/features/theme/core/provider.tsx +++ b/app/features/theme/core/provider.tsx @@ -2,11 +2,12 @@ import { useFetcher } from "@remix-run/react"; import { type ReactNode, useCallback } from "react"; import { createContext, useContext, useEffect, useState } from "react"; -enum Theme { - DARK = "dark", - LIGHT = "light", -} -const themes: Array = Object.values(Theme); +const Theme = { + DARK: "dark", + LIGHT: "light", +} as const; +type Theme = (typeof Theme)[keyof typeof Theme]; +const themes = Object.values(Theme); type ThemeContextType = { /** The CSS class to attach to the `html` tag */ diff --git a/app/modules/brackets-model/other.ts b/app/modules/brackets-model/other.ts index 8f7982294..b08b91e86 100644 --- a/app/modules/brackets-model/other.ts +++ b/app/modules/brackets-model/other.ts @@ -7,22 +7,23 @@ import type { Result } from "./unions"; /** * The possible status for a match. */ -export enum Status { +export const Status = { /** The two matches leading to this one are not completed yet. */ - Locked = 0, + Locked: 0, /** One participant is ready and waiting for the other one. */ - Waiting = 1, + Waiting: 1, /** Both participants are ready to start. */ - Ready = 2, + Ready: 2, /** The match is running. */ - Running = 3, + Running: 3, /** The match is completed. */ - Completed = 4, -} + Completed: 4, +}; +export type Status = (typeof Status)[keyof typeof Status]; /** * The results of a participant in a match. diff --git a/tsconfig.json b/tsconfig.json index 54ebb2a01..60e38802d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,6 +4,7 @@ "lib": ["DOM", "DOM.Iterable", "es2024"], "module": "ESNext", "isolatedModules": true, + "erasableSyntaxOnly": true, "esModuleInterop": true, "jsx": "react-jsx", "moduleResolution": "Bundler",