mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
fix(nuxt): ensure typed layout prop persists through build (#22855)
This commit is contained in:
parent
424dc8d7c0
commit
a256c87406
@ -81,7 +81,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}) as unknown as DefineComponent<{
|
}) as unknown as DefineComponent<{
|
||||||
name?: unknown extends PageMeta['layout'] ? MaybeRef<string | false> : PageMeta['layout']
|
name?: (unknown extends PageMeta['layout'] ? MaybeRef<string | false> : PageMeta['layout']) | undefined;
|
||||||
}>
|
}>
|
||||||
|
|
||||||
const LayoutProvider = defineComponent({
|
const LayoutProvider = defineComponent({
|
||||||
|
9
test/fixtures/basic-types/types.ts
vendored
9
test/fixtures/basic-types/types.ts
vendored
@ -7,7 +7,7 @@ import type { AppConfig, RuntimeValue } from 'nuxt/schema'
|
|||||||
import { defineNuxtConfig } from 'nuxt/config'
|
import { defineNuxtConfig } from 'nuxt/config'
|
||||||
import { callWithNuxt, isVue3 } from '#app'
|
import { callWithNuxt, isVue3 } from '#app'
|
||||||
import type { NavigateToOptions } from '#app/composables/router'
|
import type { NavigateToOptions } from '#app/composables/router'
|
||||||
import { NuxtLink, NuxtPage, WithTypes } from '#components'
|
import { NuxtLayout, NuxtLink, NuxtPage, WithTypes } from '#components'
|
||||||
import { useRouter } from '#imports'
|
import { useRouter } from '#imports'
|
||||||
|
|
||||||
interface TestResponse { message: string }
|
interface TestResponse { message: string }
|
||||||
@ -207,6 +207,13 @@ describe('layouts', () => {
|
|||||||
// @ts-expect-error Invalid layout
|
// @ts-expect-error Invalid layout
|
||||||
definePageMeta({ layout: 'invalid-layout' })
|
definePageMeta({ layout: 'invalid-layout' })
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('allows typing layouts', () => {
|
||||||
|
h(NuxtLayout, { name: 'custom' })
|
||||||
|
|
||||||
|
// @ts-expect-error Invalid layout
|
||||||
|
h(NuxtLayout, { name: 'invalid-layout' })
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('modules', () => {
|
describe('modules', () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user