From aa2fd0112dcc8203a814ff311e1f604637712bfa Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Wed, 21 Jun 2023 07:05:47 +0100 Subject: [PATCH] feat(nuxt): add types for nuxt-defined nitro runtime hooks (#21666) --- packages/nuxt/types.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/nuxt/types.d.ts b/packages/nuxt/types.d.ts index fd1c9e808c..8e35544a40 100644 --- a/packages/nuxt/types.d.ts +++ b/packages/nuxt/types.d.ts @@ -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 + 'render:island': (islandResponse: NuxtIslandResponse, context: { event: H3Event, islandContext: NuxtIslandContext }) => void | Promise + } }