diff --git a/packages/schema/src/config/typescript.ts b/packages/schema/src/config/typescript.ts index fb020816ca..a24938f237 100644 --- a/packages/schema/src/config/typescript.ts +++ b/packages/schema/src/config/typescript.ts @@ -84,7 +84,7 @@ export default defineResolvers({ /** * You can extend generated `.nuxt/tsconfig.json` using this option. - * @type {0 extends 1 & VueCompilerOptions ? typeof import('pkg-types')['TSConfig'] : typeof import('pkg-types')['TSConfig'] & { vueCompilerOptions?: Omit & { plugins?: string[] } }} + * @type {0 extends 1 & RawVueCompilerOptions ? typeof import('pkg-types')['TSConfig'] : typeof import('pkg-types')['TSConfig'] & { vueCompilerOptions?: typeof import('@vue/language-core')['RawVueCompilerOptions'] }} */ tsConfig: {}, diff --git a/packages/schema/src/types/hooks.ts b/packages/schema/src/types/hooks.ts index 7d06c6cf3a..8517afaef4 100644 --- a/packages/schema/src/types/hooks.ts +++ b/packages/schema/src/types/hooks.ts @@ -9,7 +9,7 @@ import type { Compiler, Configuration, Stats } from 'webpack' import type { Nitro, NitroConfig } from 'nitropack' import type { Schema, SchemaDefinition } from 'untyped' import type { RouteLocationRaw, RouteRecordRaw } from 'vue-router' -import type { VueCompilerOptions } from '@vue/language-core' +import type { RawVueCompilerOptions } from '@vue/language-core' import type { NuxtCompatibility, NuxtCompatibilityIssues, ViteConfig } from '..' import type { Component, ComponentsOptions } from './components' import type { Nuxt, NuxtApp, ResolvedNuxtTemplate } from './nuxt' @@ -21,9 +21,9 @@ export type TSReference = { types: string } | { path: string } export type WatchEvent = 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir' -// If the user does not have `@vue/language-core` installed, VueCompilerOptions will be typed as `any`, -// thus making the whole `VueTSConfig` type `any`. We only augment TSConfig if VueCompilerOptions is available. -export type VueTSConfig = 0 extends 1 & VueCompilerOptions ? TSConfig : TSConfig & { vueCompilerOptions?: Omit & { plugins?: string[] } } +// If the user does not have `@vue/language-core` installed, RawVueCompilerOptions will be typed as `any`, +// thus making the whole `VueTSConfig` type `any`. We only augment TSConfig if RawVueCompilerOptions is available. +export type VueTSConfig = 0 extends 1 & RawVueCompilerOptions ? TSConfig : TSConfig & { vueCompilerOptions?: RawVueCompilerOptions } export type NuxtPage = { name?: string