1- import type { Hookable , NestedHooks } from 'hookable'
2- import type { HeadHooks } from './hooks'
1+ import type { HookableCore } from 'hookable'
2+ import type { ClientHeadHooks , CoreHeadHooks , HeadHooks , ServerHeadHooks } from './hooks'
33import type { ResolvableHead } from './schema'
44import type { HeadTag , ProcessesTemplateParams , ResolvesDuplicates , TagPosition , TagPriority , TemplateParams } from './tags'
55
@@ -91,10 +91,10 @@ export interface ActiveHeadEntry<Input> {
9191
9292export type PropResolver = ( key ?: string , value ?: any , tag ?: HeadTag ) => any
9393
94- export interface CreateHeadOptions {
94+ export interface CreateHeadOptions < Hooks extends CoreHeadHooks = HeadHooks > {
9595 document ?: Document
9696 plugins ?: HeadPluginInput [ ]
97- hooks ?: NestedHooks < HeadHooks >
97+ hooks ?: Partial < Hooks >
9898 /**
9999 * Initial head input that should be added.
100100 *
@@ -111,7 +111,7 @@ export interface CreateHeadOptions {
111111 _tagWeight ?: ( tag : HeadTag ) => number
112112}
113113
114- export interface CreateServerHeadOptions extends CreateHeadOptions {
114+ export interface CreateServerHeadOptions extends CreateHeadOptions < ServerHeadHooks > {
115115 /**
116116 * Should default important tags be skipped.
117117 *
@@ -123,7 +123,7 @@ export interface CreateServerHeadOptions extends CreateHeadOptions {
123123 disableDefaults ?: boolean
124124}
125125
126- export interface CreateClientHeadOptions extends CreateHeadOptions {
126+ export interface CreateClientHeadOptions extends CreateHeadOptions < ClientHeadHooks > {
127127 /**
128128 * Custom render function for DOM updates.
129129 */
@@ -142,9 +142,9 @@ export interface HeadEntryOptions extends TagPosition, TagPriority, ProcessesTem
142142 _index ?: number
143143}
144144
145- export type HeadRenderer < T = unknown > = ( head : Unhead < any > ) => T
145+ export type HeadRenderer < T = unknown , H extends CoreHeadHooks = CoreHeadHooks > = ( head : Unhead < any , any , H > ) => T
146146
147- export interface Unhead < Input = ResolvableHead , RenderResult = unknown > {
147+ export interface Unhead < Input = ResolvableHead , RenderResult = unknown , Hooks extends CoreHeadHooks = HeadHooks > {
148148 /**
149149 * Render the head tags using the configured renderer.
150150 */
@@ -164,7 +164,7 @@ export interface Unhead<Input = ResolvableHead, RenderResult = unknown> {
164164 /**
165165 * Exposed hooks for easier extension.
166166 */
167- hooks : Hookable < HeadHooks >
167+ hooks : HookableCore < Hooks >
168168 /**
169169 * Resolved options
170170 */
0 commit comments