fix(schema): use RawVueCompilerOptions for unresolved tsconfig (#31202)

This commit is contained in:
Kevin Deng 三咲智子 2025-03-05 00:32:01 +08:00 committed by Daniel Roe
parent 903597a48d
commit 86520bd0ec
No known key found for this signature in database
GPG Key ID: 3714AB03996F442B
2 changed files with 5 additions and 5 deletions

View File

@ -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<typeof import('@vue/language-core')['VueCompilerOptions'], 'plugins'> & { 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: {},

View File

@ -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<VueCompilerOptions, 'plugins'> & { 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