diff --git a/packages/nuxt/src/core/templates.ts b/packages/nuxt/src/core/templates.ts index 2604a7b416..a879599789 100644 --- a/packages/nuxt/src/core/templates.ts +++ b/packages/nuxt/src/core/templates.ts @@ -135,7 +135,7 @@ export const schemaTemplate = { ` [${genString(meta.configKey)}]?: typeof ${genDynamicImport(meta.importName, { wrapper: false })}.default extends NuxtModule ? Partial : Record` ), ' }', - 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') } diff --git a/packages/schema/src/types/config.ts b/packages/schema/src/types/config.ts index 0446e1aa26..827c3fbdc6 100644 --- a/packages/schema/src/types/config.ts +++ b/packages/schema/src/types/config.ts @@ -16,15 +16,12 @@ export interface NuxtOptions extends ConfigSchema { type RuntimeConfigNamespace = Record -/** @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 - -export interface RuntimeConfig extends LegacyRuntimeConfig, RuntimeConfigNamespace { - app: RuntimeConfigNamespace - public: RuntimeConfigNamespace +export interface RuntimeConfig extends PrivateRuntimeConfig, RuntimeConfigNamespace { + public: PublicRuntimeConfig }