fix(schema): don't narrow head string types to literals (#27540)

This commit is contained in:
Daniel Roe 2024-06-11 17:44:38 +01:00 committed by GitHub
parent 14fecc9f73
commit 1d94bac0af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -141,7 +141,7 @@ export interface AppConfigInput extends CustomAppConfig {
server?: never server?: never
} }
type Serializable<T> = T extends Function ? never : T extends Promise<infer U> ? Serializable<U> : T extends Record<string, any> ? { [K in keyof T]: Serializable<T[K]> } : T type Serializable<T> = T extends Function ? never : T extends Promise<infer U> ? Serializable<U> : T extends string & {} ? T : T extends Record<string, any> ? { [K in keyof T]: Serializable<T[K]> } : T
export interface NuxtAppConfig { export interface NuxtAppConfig {
head: Serializable<AppHeadMetaObject> head: Serializable<AppHeadMetaObject>

View File

@ -21,6 +21,13 @@ export default defineNuxtConfig({
title: Promise.resolve('Nuxt Fixture'), title: Promise.resolve('Nuxt Fixture'),
// @ts-expect-error Functions are not allowed // @ts-expect-error Functions are not allowed
titleTemplate: title => 'test', titleTemplate: title => 'test',
meta: [
{
// Allows unknown property
property: 'og:thing',
content: '1234567890',
},
],
}, },
pageTransition: { pageTransition: {
// @ts-expect-error Functions are not allowed // @ts-expect-error Functions are not allowed