feat(nuxt): add types for nuxt-defined nitro runtime hooks (#21666)

This commit is contained in:
Daniel Roe 2023-06-21 07:05:47 +01:00 committed by GitHub
parent 5460873161
commit aa2fd0112d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@
export * from './dist/index'
import type { SchemaDefinition } from 'nuxt/schema'
import type { NuxtIslandContext, NuxtIslandResponse, NuxtRenderHTMLContext } from './dist/core/runtime/nitro/renderer'
declare global {
const defineNuxtConfig: typeof import('nuxt/config')['defineNuxtConfig']
@ -17,4 +18,8 @@ declare module 'nitropack' {
ssr?: boolean
experimentalNoScripts?: boolean
}
interface NitroRuntimeHooks {
'render:html': (htmlContext: NuxtRenderHTMLContext, context: { event: H3Event }) => void | Promise<void>
'render:island': (islandResponse: NuxtIslandResponse, context: { event: H3Event, islandContext: NuxtIslandContext }) => void | Promise<void>
}
}