From 1d94bac0af8962e8526aa580374e5c6cabd927a0 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 11 Jun 2024 17:44:38 +0100 Subject: [PATCH] fix(schema): don't narrow head string types to literals (#27540) --- packages/schema/src/types/config.ts | 2 +- test/fixtures/basic-types/nuxt.config.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/schema/src/types/config.ts b/packages/schema/src/types/config.ts index 7306c5222e..44a1390734 100644 --- a/packages/schema/src/types/config.ts +++ b/packages/schema/src/types/config.ts @@ -141,7 +141,7 @@ export interface AppConfigInput extends CustomAppConfig { server?: never } -type Serializable = T extends Function ? never : T extends Promise ? Serializable : T extends Record ? { [K in keyof T]: Serializable } : T +type Serializable = T extends Function ? never : T extends Promise ? Serializable : T extends string & {} ? T : T extends Record ? { [K in keyof T]: Serializable } : T export interface NuxtAppConfig { head: Serializable diff --git a/test/fixtures/basic-types/nuxt.config.ts b/test/fixtures/basic-types/nuxt.config.ts index 3278402fa3..93a409cc04 100644 --- a/test/fixtures/basic-types/nuxt.config.ts +++ b/test/fixtures/basic-types/nuxt.config.ts @@ -21,6 +21,13 @@ export default defineNuxtConfig({ title: Promise.resolve('Nuxt Fixture'), // @ts-expect-error Functions are not allowed titleTemplate: title => 'test', + meta: [ + { + // Allows unknown property + property: 'og:thing', + content: '1234567890', + }, + ], }, pageTransition: { // @ts-expect-error Functions are not allowed