fix(schema): extend NuxtOptions for nitro & bridge types (#2131)

This commit is contained in:
Daniel Roe 2021-11-24 15:51:26 +00:00 committed by GitHub
parent ae80e5bdc8
commit 7a78bce449
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 7 deletions

View File

@ -19,13 +19,12 @@ export interface BridgeConfig {
// TODO: Also inherit from @nuxt/types.NuxtConfig for legacy type compat // TODO: Also inherit from @nuxt/types.NuxtConfig for legacy type compat
export interface NuxtConfig extends _NuxtConfig { export interface NuxtConfig extends _NuxtConfig {
bridge?: Partial<BridgeConfig> | false
head?: _NuxtConfig['head'] | MetaInfo head?: _NuxtConfig['head'] | MetaInfo
} }
declare module '@nuxt/kit' { declare module '@nuxt/schema' {
interface ConfigSchema { interface NuxtConfig {
bridge: BridgeConfig bridge?: Partial<BridgeConfig> | false
} }
} }

View File

@ -1,9 +1,9 @@
import './shims' import './shims'
import { NitroInput } from '../dist' import { NitroInput } from '../dist'
declare module '@nuxt/kit' { declare module '@nuxt/schema' {
interface ConfigSchema { interface NuxtConfig {
nitro: NitroInput nitro?: NitroInput
} }
} }

View File

@ -1,9 +1,11 @@
import { ConfigSchema } from '../../schema/config' import { ConfigSchema } from '../../schema/config'
/** Normalized Nuxt options available as `nuxt.options.*` */
export interface NuxtOptions extends ConfigSchema { } export interface NuxtOptions extends ConfigSchema { }
type DeepPartial<T> = T extends Record<string, any> ? { [P in keyof T]?: DeepPartial<T[P]> | T[P] } : T type DeepPartial<T> = T extends Record<string, any> ? { [P in keyof T]?: DeepPartial<T[P]> | T[P] } : T
/** User configuration in `nuxt.config` file */
export interface NuxtConfig extends DeepPartial<ConfigSchema> { } export interface NuxtConfig extends DeepPartial<ConfigSchema> { }