@@ -122,11 +122,31 @@ export function BlockContentWrapper<
122122 * Can accept either functions that return the required objects, or the objects directly.
123123 */
124124export function createReactBlockSpec <
125- TName extends string ,
126- TProps extends PropSchema ,
127- TContent extends "inline" | "none" ,
128- BlockConf extends BlockConfig < TName , TProps , TContent > ,
129- TOptions extends Partial < Record < string , any > > ,
125+ const TName extends string ,
126+ const TProps extends PropSchema ,
127+ const TContent extends "inline" | "none" ,
128+ const TOptions extends Record < string , any > | undefined = undefined ,
129+ > (
130+ blockConfigOrCreator : BlockConfig < TName , TProps , TContent > ,
131+ blockImplementationOrCreator :
132+ | ReactCustomBlockImplementation < TName , TProps , TContent >
133+ | ( TOptions extends undefined
134+ ? ( ) => ReactCustomBlockImplementation < TName , TProps , TContent >
135+ : (
136+ options : Partial < TOptions > ,
137+ ) => ReactCustomBlockImplementation < TName , TProps , TContent > ) ,
138+ extensionsOrCreator ?:
139+ | BlockNoteExtension < any > [ ]
140+ | ( TOptions extends undefined
141+ ? ( ) => BlockNoteExtension < any > [ ]
142+ : ( options : Partial < TOptions > ) => BlockNoteExtension < any > [ ] ) ,
143+ ) : ( options ?: Partial < TOptions > ) => BlockSpec < TName , TProps , TContent > ;
144+ export function createReactBlockSpec <
145+ const TName extends string ,
146+ const TProps extends PropSchema ,
147+ const TContent extends "inline" | "none" ,
148+ const BlockConf extends BlockConfig < TName , TProps , TContent > ,
149+ const TOptions extends Partial < Record < string , any > > ,
130150> (
131151 blockCreator : ( options : Partial < TOptions > ) => BlockConf ,
132152 blockImplementationOrCreator :
@@ -142,7 +162,7 @@ export function createReactBlockSpec<
142162 BlockConf [ "content" ]
143163 >
144164 : (
145- options : TOptions ,
165+ options : Partial < TOptions > ,
146166 ) => ReactCustomBlockImplementation <
147167 BlockConf [ "type" ] ,
148168 BlockConf [ "propSchema" ] ,
@@ -152,19 +172,19 @@ export function createReactBlockSpec<
152172 | BlockNoteExtension < any > [ ]
153173 | ( TOptions extends undefined
154174 ? ( ) => BlockNoteExtension < any > [ ]
155- : ( options : TOptions ) => BlockNoteExtension < any > [ ] ) ,
175+ : ( options : Partial < TOptions > ) => BlockNoteExtension < any > [ ] ) ,
156176) : (
157- options ?: TOptions ,
177+ options ?: Partial < TOptions > ,
158178) => BlockSpec <
159179 BlockConf [ "type" ] ,
160180 BlockConf [ "propSchema" ] ,
161181 BlockConf [ "content" ]
162182> ;
163183export function createReactBlockSpec <
164- TName extends string ,
165- TProps extends PropSchema ,
166- TContent extends "inline" | "none" ,
167- TOptions extends Record < string , any > | undefined = undefined ,
184+ const TName extends string ,
185+ const TProps extends PropSchema ,
186+ const TContent extends "inline" | "none" ,
187+ const TOptions extends Record < string , any > | undefined = undefined ,
168188> (
169189 blockConfigOrCreator :
170190 | BlockConfig < TName , TProps , TContent >
@@ -183,7 +203,7 @@ export function createReactBlockSpec<
183203 | ( TOptions extends undefined
184204 ? ( ) => BlockNoteExtension < any > [ ]
185205 : ( options : Partial < TOptions > ) => BlockNoteExtension < any > [ ] ) ,
186- ) : ( options ?: TOptions ) => BlockSpec < TName , TProps , TContent > {
206+ ) : ( options ?: Partial < TOptions > ) => BlockSpec < TName , TProps , TContent > {
187207 return ( options = { } as TOptions ) => {
188208 const blockConfig =
189209 typeof blockConfigOrCreator === "function"
0 commit comments