mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-16 21:58:19 +00:00
fix(schema): add back PublicRuntimeConfig
interface for augmentation (#4849)
This commit is contained in:
parent
a5ba1df37a
commit
e0125f49ff
@ -135,7 +135,7 @@ export const schemaTemplate = {
|
|||||||
` [${genString(meta.configKey)}]?: typeof ${genDynamicImport(meta.importName, { wrapper: false })}.default extends NuxtModule<infer O> ? Partial<O> : Record<string, any>`
|
` [${genString(meta.configKey)}]?: typeof ${genDynamicImport(meta.importName, { wrapper: false })}.default extends NuxtModule<infer O> ? Partial<O> : Record<string, any>`
|
||||||
),
|
),
|
||||||
' }',
|
' }',
|
||||||
generateTypes(resolveSchema(nuxt.options.runtimeConfig),
|
generateTypes(resolveSchema(Object.fromEntries(Object.entries(nuxt.options.runtimeConfig).filter(([key]) => key !== 'public'))),
|
||||||
{
|
{
|
||||||
interfaceName: 'RuntimeConfig',
|
interfaceName: 'RuntimeConfig',
|
||||||
addExport: false,
|
addExport: false,
|
||||||
@ -143,6 +143,14 @@ export const schemaTemplate = {
|
|||||||
allowExtraKeys: false,
|
allowExtraKeys: false,
|
||||||
indentation: 2
|
indentation: 2
|
||||||
}),
|
}),
|
||||||
|
generateTypes(resolveSchema(nuxt.options.runtimeConfig.public),
|
||||||
|
{
|
||||||
|
interfaceName: 'PublicRuntimeConfig',
|
||||||
|
addExport: false,
|
||||||
|
addDefaults: false,
|
||||||
|
allowExtraKeys: false,
|
||||||
|
indentation: 2
|
||||||
|
}),
|
||||||
'}'
|
'}'
|
||||||
].join('\n')
|
].join('\n')
|
||||||
}
|
}
|
||||||
|
@ -16,15 +16,12 @@ export interface NuxtOptions extends ConfigSchema {
|
|||||||
|
|
||||||
type RuntimeConfigNamespace = Record<string, any>
|
type RuntimeConfigNamespace = Record<string, any>
|
||||||
|
|
||||||
/** @deprecated use RuntimeConfig interface */
|
|
||||||
export interface PublicRuntimeConfig extends RuntimeConfigNamespace { }
|
export interface PublicRuntimeConfig extends RuntimeConfigNamespace { }
|
||||||
|
|
||||||
|
// TODO: remove before release of 3.0.0
|
||||||
/** @deprecated use RuntimeConfig interface */
|
/** @deprecated use RuntimeConfig interface */
|
||||||
export interface PrivateRuntimeConfig extends PublicRuntimeConfig { }
|
export interface PrivateRuntimeConfig extends RuntimeConfigNamespace { }
|
||||||
|
|
||||||
type LegacyRuntimeConfig = PublicRuntimeConfig & Partial<PrivateRuntimeConfig>
|
export interface RuntimeConfig extends PrivateRuntimeConfig, RuntimeConfigNamespace {
|
||||||
|
public: PublicRuntimeConfig
|
||||||
export interface RuntimeConfig extends LegacyRuntimeConfig, RuntimeConfigNamespace {
|
|
||||||
app: RuntimeConfigNamespace
|
|
||||||
public: RuntimeConfigNamespace
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user