diff --git a/app/router.d.ts b/app/router.d.ts deleted file mode 100644 index abaf88164..000000000 --- a/app/router.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { RouteRecordRaw } from 'vue-router'; - -declare global { - var originalRoutes: readonly RouteRecordRaw[]; -} diff --git a/app/types.d.ts b/app/types.d.ts new file mode 100644 index 000000000..252c33d59 --- /dev/null +++ b/app/types.d.ts @@ -0,0 +1,28 @@ +import type { RouteMeta, RouteRecordRaw } from 'vue-router'; + +import type { Config } from '~~/locale/config.ts'; +import type { Pronoun } from '~~/shared/classes.ts'; +import type { NounConvention } from '~~/shared/nouns.ts'; + +declare global { + var originalRoutes: readonly RouteRecordRaw[]; +} + +interface TranslatedRoute { + paths: string[]; + meta?: RouteMeta; +} + +declare module 'nuxt/app' { + interface PageMeta { + translatedPaths?: (config: Config) => string[] | Record; + } +} + +declare module 'vue-router' { + interface RouteMeta { + headerCategory?: string; + pronoun?: Pronoun; + nounConvention?: WithKey; + } +} diff --git a/nuxt.config.ts b/nuxt.config.ts index a6b43f7bc..61bedc963 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -6,7 +6,6 @@ import { resolvePath } from '@nuxt/kit'; import yamlPlugin from '@rollup/plugin-yaml'; import { sentryVitePlugin } from '@sentry/vite-plugin'; import { defineNuxtConfig } from 'nuxt/config'; -import type { RouteMeta } from 'vue-router'; import type { Config } from './locale/config.ts'; import localeDescriptions from './locale/locales.ts'; @@ -16,31 +15,9 @@ import sumlPlugin from './plugins/rollup/suml.ts'; import tsvPlugin from './plugins/rollup/tsv.ts'; import { loadSuml } from './server/loader.ts'; -import type { Pronoun } from '~~/shared/classes.ts'; -import type { NounConvention } from '~~/shared/nouns.ts'; - const exec = promisify(childProcess.exec); const version = (await exec('git log -n 1 --pretty=format:"%H"')).stdout; -interface TranslatedRoute { - paths: string[]; - meta?: RouteMeta; -} - -declare module 'nuxt/app' { - interface PageMeta { - translatedPaths?: (config: Config) => string[] | Record; - } -} - -declare module 'vue-router' { - interface RouteMeta { - headerCategory?: string; - pronoun?: Pronoun; - nounConvention?: WithKey; - } -} - const config = await loadSuml('locale/_/config.suml'); const translations = await loadSuml('locale/_/translations.suml'); diff --git a/shared/cookieSettings.ts b/shared/cookieSettings.ts index 6e30be26d..e93510edb 100644 --- a/shared/cookieSettings.ts +++ b/shared/cookieSettings.ts @@ -1,4 +1,4 @@ -import type { CookieOptions } from '#app/composables/cookie'; +import type { CookieOptions } from 'nuxt/app'; export const sessionCookieSetting: CookieOptions & { readonly?: false } = { sameSite: 'lax', diff --git a/shared/helpers.ts b/shared/helpers.ts index 15a59348a..0cfa15b05 100644 --- a/shared/helpers.ts +++ b/shared/helpers.ts @@ -56,6 +56,8 @@ export const now = runningSnapshotTests ? () => 1735689600 // 2025-01-01T00:00:00.000Z : () => Math.floor(Date.now() / 1000); +type GeneratorFunc = (...args: Args) => Generator; + export const buildDict = ( fn: GeneratorFunc<[K, V], Args>, ...args: Args ): Record => { diff --git a/shared/types/express.d.ts b/shared/types/express.d.ts index 9eb782126..edba8ebc5 100644 --- a/shared/types/express.d.ts +++ b/shared/types/express.d.ts @@ -4,8 +4,6 @@ import type { PermissionArea } from '~~/shared/helpers.ts'; import type { User } from '~~/shared/user.ts'; declare global { - type GeneratorFunc = (...args: Args) => Generator; - namespace Express { export interface Request { rawUser: User | undefined;