`);\r\n console.log(event.node.res.statusCode);\r\n });\r\n});\r\n```\r\n\r\nAnd I get the following typescript errors:\r\n\r\n- Argument of type '\"render:html\"' is not assignable to parameter of type 'HookKeys\u003CNitroRuntimeHooks>'.ts(2345)\r\n- Property 'head' does not exist on type 'Partial\u003CRenderResponse>'.ts(2339)\r\n\r\nLooking at `node_modules/nitropack/dist/runtime/types.d.ts`, it seems that `NitroRuntimeHooks` interface is missing `\"render:html\"` property\r\n\r\n\r\n\r\nIn order to resolve this issue, the `NitroRuntimeHooks` interface should be updated to include \"render:html\" property. (https://github.com/unjs/nitro/blob/main/src/runtime/types.ts#L23)\n\n### Additional context\n\n_No response_\n\n### Logs\n\n```shell-script\n$ npx tsc\r\nserver/plugins/extend-html.ts:2:23 - error TS2345: Argument of type '\"render:html\"' is not assignable to parameter of type 'HookKeys\u003CNitroRuntimeHooks>'.\r\n\r\n2 nitroApp.hooks.hook(\"render:html\", (html, { event }) => {\r\n ~~~~~~~~~~~~~\r\n\r\nserver/plugins/extend-html.ts:3:10 - error TS2339: Property 'head' does not exist on type 'Partial\u003CRenderResponse>'.\r\n\r\n3 html.head.push(`\u003Cmeta name=\"author\" content=\"Paul Kim\" />`);\r\n ~~~~\r\n\r\n\r\nFound 2 errors in the same file, starting at: server/plugins/extend-html.ts:2\n```\n",[3230,3231],{"name":3183,"color":3184},{"name":3165,"color":3166},21708,"Typescript error when using Nitro plugin due to missing type for \"render:html\"","2023-07-07T10:28:31Z","https://github.com/nuxt/nuxt/issues/21708",0.69920814,{"description":3238,"labels":3239,"number":3245,"owner":3155,"repository":3155,"state":3191,"title":3246,"updated_at":3247,"url":3248,"score":3249},"### Environment\r\n\r\n- Operating System: Windows_NT\r\n- Node Version: v18.12.1\r\n- Nuxt Version: 3.5.3\r\n- Nitro Version: 2.5.0\r\n- Package Manager: npm@8.19.2\r\n- Builder: vite\r\n- User Config: ssr, telemetry, runtimeConfig, app, typescript, build, alias, vite, nitro, hooks, modules, routeRules, css, devtools, devServer\r\n- Runtime Modules: @nuxtjs/tailwindcss@6.8.0, @nuxtjs/i18n@8.0.0-beta.10, @nuxt/devtools@0.4.6\r\n\r\n### Reproduction\r\n\r\nUse the `render:html` hook from Nuxt inside a nitro plugin hook (like described in https://nuxt.com/docs/guide/going-further/hooks#usage-within-a-nitro-plugin) by creating a file with:\r\n`server/plugins/xyz.ts`\r\n```\r\nexport default defineNitroPlugin((nitroApp) => {\r\n nitroApp.hooks.hook('render:html', (html: NuxtRenderHTMLContext, { event }: { event: H3Event }) => {\r\n ^^^^^^^^^^^\r\n ...\r\n});\r\n```\r\n\r\n### Describe the bug\r\n\r\nAfter updating from Nuxt `3.5.1` to `3.5.3` TS is throwing:\r\n```\r\nerror TS2345: Argument of type '\"render:html\"' is not assignable to parameter of type 'HookKeys\u003CNitroRuntimeHooks>'.\r\n```\r\nThis is caused by the newly introduced typing with https://github.com/unjs/nitro/pull/1316/files#r1233083925\r\n\r\nNuxt is using custom hooks (like `render:html`) but there are not part of the typing (it is not extensible).\r\n\r\n### Additional context\r\n\r\nhttps://github.com/nuxt/nuxt/blob/71ef8bd3ff207fd51c2ca18d5a8c7140476780c7/packages/nuxt/src/core/runtime/nitro/renderer.ts#L228\r\n\r\n### Logs\r\n\r\n_No response_",[3240,3241,3242,3243,3244],{"name":3146,"color":3147},{"name":3183,"color":3184},{"name":3149,"color":3150},{"name":3171,"color":3172},{"name":3152,"color":3153},21693,"type error when using 'render:html' hook in nitro plugin","2023-06-23T13:30:57Z","https://github.com/nuxt/nuxt/issues/21693",0.7001382,{"description":3251,"labels":3252,"number":3260,"owner":3155,"repository":3155,"state":3191,"title":3261,"updated_at":3262,"url":3263,"score":3264},"### Environment\r\n\r\n- Operating System: `Darwin`\r\n- Node Version: `v20.10.0`\r\n- Nuxt Version: `3.8.0`\r\n- CLI Version: `3.9.1`\r\n- Nitro Version: `2.7.0`\r\n- Package Manager: `npm@8.19.4`\r\n- Builder: `-`\r\n- User Config: `app`, `extends`, `runtimeConfig`, `modules`, `vue`\r\n- Runtime Modules: `-`\r\n- Build Modules: `-`\r\n\r\n### Reproduction\r\n\r\nExecute the following client-side. It will throw a type error even though TypeScript is perfectly fine with such code.\r\n\r\n```ts\r\nconst event = useRequestEvent()\r\nconsole.log(event.property) // Type error. Reading property of undefined.\r\n```\r\n\r\n### Describe the bug\r\n\r\nThe helper function `useRequestEvent` may be executed seamlessly on both client and server sides. However, they do not return the same thing.\r\n\r\n- On the server, it returns a proper `H3Event` instance.\r\n- On the client, it returns `undefined`.\r\n\r\nHowever, its return type does not reflect that. [It's manually cast into `H3Event`](https://github.com/nuxt/nuxt/blob/44fcacba846a6cdf33e1475fc8413f6ae49d1fe4/packages/nuxt/src/app/composables/ssr.ts#L8-L10). \r\n\r\nThis forces the consumers to add a defensive layer if they want to be type-safe. Below is an example of such a layer.\r\n\r\n```ts\r\nconst event = useRequestEvent() as H3Event | undefined\r\n\r\nif (event) {\r\n // ...\r\n}\r\n```\r\n\r\nSuch boilerplate clutters the consumer code, and requires the `H3Event` type to be imported. Needless to say that it's also extremely easy to forget about such a defensive layer, and introduce type errors at runtime.\r\n\r\n### Additional context\r\n\r\n/\r\n\r\n### Logs\r\n\r\n```shell-script\r\n/\r\n```\r\n",[3253,3256,3257,3258,3259],{"name":3254,"color":3255},"good first issue","fbca04",{"name":3146,"color":3147},{"name":3183,"color":3184},{"name":3149,"color":3150},{"name":3152,"color":3153},25442,"`useRequestEvent` return type should be `H3Event | undefined`","2024-01-29T17:19:55Z","https://github.com/nuxt/nuxt/issues/25442",0.7053518,{"description":3266,"labels":3267,"number":3272,"owner":3155,"repository":3155,"state":3191,"title":3273,"updated_at":3274,"url":3275,"score":3276},"### Environment\r\n\r\n------------------------------\r\n- Operating System: Darwin\r\n- Node Version: v18.16.1\r\n- Nuxt Version: 3.6.5\r\n- Nitro Version: 2.5.2\r\n- Package Manager: pnpm@8.5.0\r\n- Builder: vite\r\n- User Config: devtools, nitro\r\n- Runtime Modules: -\r\n- Build Modules: -\r\n------------------------------\r\n\r\n### Reproduction\r\n\r\nhttps://stackblitz.com/edit/nuxt-22572?file=nuxt.config.ts\r\n\r\n1. Open the repo and `nuxt.config.ts`\r\n2. See no TS errors\r\n3. See errors when running as `defineEventHandler` is not defined but gives false type safety.\r\n\r\n### Describe the bug\r\n\r\nIn the `nuxt.config.ts`, imports like `defineEventHandler` or `$fetch` are wrongly \"available\" as auto-imports on the type-level, while using them without importing them would throw.\r\n\r\n### Additional context\r\n\r\n_No response_\r\n\r\n### Logs\r\n\r\n_No response_",[3268,3269],{"name":3146,"color":3147},{"name":3270,"color":3271},"🍰 p2-nice-to-have","0E8A16",22572,"separate type contexts for nitro, nuxt & modules/nuxt.config","2025-06-25T16:43:28Z","https://github.com/nuxt/nuxt/issues/22572",0.7059199,["Reactive",3278],{},["Set"],["ShallowReactive",3281],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fiHWWWS18OJgLsOxSaQiaTJJONnYvF61mBJaJ6GC1lXQ":-1},"/nuxt/nuxt/23478"]