From 7e05b6e7853da98ec93ca72acd72af1fe272eafe Mon Sep 17 00:00:00 2001 From: Dawid Kopys Date: Sat, 29 Jul 2023 20:14:08 +0200 Subject: [PATCH 1/2] docs: correct manually typing runtime config example (#22393) --- docs/2.guide/3.going-further/10.runtime-config.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/2.guide/3.going-further/10.runtime-config.md b/docs/2.guide/3.going-further/10.runtime-config.md index d9c76dc972..268b5dd945 100644 --- a/docs/2.guide/3.going-further/10.runtime-config.md +++ b/docs/2.guide/3.going-further/10.runtime-config.md @@ -150,9 +150,9 @@ It is also possible to type your runtime config manually: declare module 'nuxt/schema' { interface RuntimeConfig { apiSecret: string - public: { - apiBase: string - } + } + interface PublicRuntimeConfig { + apiBase: string } } // It is always important to ensure you import/export something when augmenting a type From c044d0eef57467622a103776d9846b41175ce653 Mon Sep 17 00:00:00 2001 From: Aleksandra Date: Sat, 29 Jul 2023 20:32:28 +0200 Subject: [PATCH 2/2] perf(nuxt): export DefineNuxtConfig interface from `nuxt/config` (#22391) --- packages/nuxt/config.d.ts | 3 ++- packages/nuxt/types.d.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/nuxt/config.d.ts b/packages/nuxt/config.d.ts index ddd2beade0..8eab74f3c6 100644 --- a/packages/nuxt/config.d.ts +++ b/packages/nuxt/config.d.ts @@ -2,4 +2,5 @@ import type { NuxtConfig } from 'nuxt/schema' import type { DefineConfig, InputConfig, UserInputConfig, ConfigLayerMeta } from 'c12' export { NuxtConfig } from 'nuxt/schema' -export declare const defineNuxtConfig: DefineConfig +export interface DefineNuxtConfig extends DefineConfig {} +export declare const defineNuxtConfig: DefineNuxtConfig diff --git a/packages/nuxt/types.d.ts b/packages/nuxt/types.d.ts index 220045a6a6..d2dddd2211 100644 --- a/packages/nuxt/types.d.ts +++ b/packages/nuxt/types.d.ts @@ -1,12 +1,13 @@ /// export * from './dist/index' +import type { DefineNuxtConfig } from 'nuxt/config' import type { SchemaDefinition, RuntimeConfig } from 'nuxt/schema' import type { H3Event } from 'h3' import type { NuxtIslandContext, NuxtIslandResponse, NuxtRenderHTMLContext } from './dist/core/runtime/nitro/renderer' declare global { - const defineNuxtConfig: typeof import('nuxt/config')['defineNuxtConfig'] + const defineNuxtConfig: DefineNuxtConfig const defineNuxtSchema: (schema: SchemaDefinition) => SchemaDefinition }