diff --git a/src/api/sets/types.ts b/src/api/sets/types.ts index b29ba56b..bfe277fb 100644 --- a/src/api/sets/types.ts +++ b/src/api/sets/types.ts @@ -1,14 +1,14 @@ import type { Database } from "@/integrations/supabase/types"; import type { Artist } from "@/api/artists/types"; import { asEnumValue } from "@/lib/enum"; - -export const SET_TYPES = ["music", "workshop", "performance", "other"] as const; - -export type SetType = (typeof SET_TYPES)[number]; - -export function asSetType(value: string | null): SetType | null { - return asEnumValue(SET_TYPES, value); -} +import { + SET_TYPES, + asSetType, + type SetType, +} from "@functions/_shared/setTypes.ts"; + +export { SET_TYPES, asSetType }; +export type { SetType }; export function isNonMusicSetType( setType: SetType | null, diff --git a/supabase/functions/_shared/setTypes.ts b/supabase/functions/_shared/setTypes.ts index 15b4960c..f0c6fb6b 100644 --- a/supabase/functions/_shared/setTypes.ts +++ b/supabase/functions/_shared/setTypes.ts @@ -1,6 +1,6 @@ /** - * Mirrors SET_TYPES in src/api/sets/types.ts and the sets_set_type_check - * constraint. Keep the three in sync when adding a type. + * Single TypeScript definition of set types: src/api/sets/types.ts re-exports + * it, so this file must stay dependency-free (Deno can't resolve `@/` aliases). */ export const SET_TYPES = ["music", "workshop", "performance", "other"] as const; diff --git a/tsconfig.app.json b/tsconfig.app.json index 6650053e..f8d6e487 100644 --- a/tsconfig.app.json +++ b/tsconfig.app.json @@ -23,7 +23,8 @@ "baseUrl": ".", "paths": { - "@/*": ["./src/*"] + "@/*": ["./src/*"], + "@functions/*": ["./supabase/functions/*"] } }, "include": ["src"] diff --git a/tsconfig.json b/tsconfig.json index c04f96c2..cde71290 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,7 +7,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "@/*": ["./src/*"] + "@/*": ["./src/*"], + "@functions/*": ["./supabase/functions/*"] }, "skipLibCheck": true, "allowJs": true, diff --git a/vite.config.ts b/vite.config.ts index b878ca33..af51a426 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -90,6 +90,7 @@ export default defineConfig(({ mode }) => ({ resolve: { alias: { "@": path.resolve(__dirname, "./src"), + "@functions": path.resolve(__dirname, "./supabase/functions"), }, }, })); diff --git a/vitest.config.ts b/vitest.config.ts index e95aa9b5..68d797ca 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -25,6 +25,7 @@ export default defineConfig({ resolve: { alias: { "@": path.resolve(__dirname, "./src"), + "@functions": path.resolve(__dirname, "./supabase/functions"), }, }, }); diff --git a/vitest.integration.config.ts b/vitest.integration.config.ts index 38cafb11..27f47af3 100644 --- a/vitest.integration.config.ts +++ b/vitest.integration.config.ts @@ -19,6 +19,7 @@ export default defineConfig({ resolve: { alias: { "@": path.resolve(__dirname, "./src"), + "@functions": path.resolve(__dirname, "./supabase/functions"), }, }, });