mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +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>`
|
||||
),
|
||||
' }',
|
||||
generateTypes(resolveSchema(nuxt.options.runtimeConfig),
|
||||
generateTypes(resolveSchema(Object.fromEntries(Object.entries(nuxt.options.runtimeConfig).filter(([key]) => key !== 'public'))),
|
||||
{
|
||||
interfaceName: 'RuntimeConfig',
|
||||
addExport: false,
|
||||
@ -143,6 +143,14 @@ export const schemaTemplate = {
|
||||
allowExtraKeys: false,
|
||||
indentation: 2
|
||||
}),
|
||||
generateTypes(resolveSchema(nuxt.options.runtimeConfig.public),
|
||||
{
|
||||
interfaceName: 'PublicRuntimeConfig',
|
||||
addExport: false,
|
||||
addDefaults: false,
|
||||
allowExtraKeys: false,
|
||||
indentation: 2
|
||||
}),
|
||||
'}'
|
||||
].join('\n')
|
||||
}
|
||||
|
@ -16,15 +16,12 @@ export interface NuxtOptions extends ConfigSchema {
|
||||
|
||||
type RuntimeConfigNamespace = Record<string, any>
|
||||
|
||||
/** @deprecated use RuntimeConfig interface */
|
||||
export interface PublicRuntimeConfig extends RuntimeConfigNamespace { }
|
||||
|
||||
// TODO: remove before release of 3.0.0
|
||||
/** @deprecated use RuntimeConfig interface */
|
||||
export interface PrivateRuntimeConfig extends PublicRuntimeConfig { }
|
||||
export interface PrivateRuntimeConfig extends RuntimeConfigNamespace { }
|
||||
|
||||
type LegacyRuntimeConfig = PublicRuntimeConfig & Partial<PrivateRuntimeConfig>
|
||||
|
||||
export interface RuntimeConfig extends LegacyRuntimeConfig, RuntimeConfigNamespace {
|
||||
app: RuntimeConfigNamespace
|
||||
public: RuntimeConfigNamespace
|
||||
export interface RuntimeConfig extends PrivateRuntimeConfig, RuntimeConfigNamespace {
|
||||
public: PublicRuntimeConfig
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user