@@ -110,6 +110,7 @@ function linkToNodes(
110110 * prosemirror text nodes with the appropriate marks
111111 */
112112function styledTextArrayToNodes < S extends StyleSchema > (
113+ // this is lenient to "partial" inline content. FIXME: let's simplify and remove support for `string` here
113114 content : string | StyledText < S > [ ] ,
114115 schema : Schema ,
115116 styleSchema : S ,
@@ -144,6 +145,7 @@ export function inlineContentToNodes<
144145 I extends InlineContentSchema ,
145146 S extends StyleSchema ,
146147> (
148+ // this is lenient to "partial" inline content. FIXME: let's simplify and remove support for `string[]` here
147149 blockContent : string [ ] | InlineContent < I , S > [ ] ,
148150 schema : Schema ,
149151 blockType ?: string ,
@@ -278,40 +280,34 @@ function blockOrInlineContentToContentNode(
278280 schema : Schema ,
279281 styleSchema : StyleSchema ,
280282) {
283+ const type = block . type ;
281284 let contentNode : Node ;
282- let type = block . type ;
283-
284- // TODO: needed? came from previous code
285- if ( type === undefined ) {
286- // TODO: remove
287- type = "paragraph" ;
288- }
289285
290286 if ( ! schema . nodes [ type ] ) {
291287 throw new Error ( `node type ${ type } not found in schema` ) ;
292288 }
293289
294290 if ( ! block . content ) {
295- contentNode = schema . nodes [ type ] . createChecked ( block . props as any ) ;
291+ contentNode = schema . nodes [ type ] . createChecked ( block . props ) ;
296292 } else if ( typeof block . content === "string" ) {
297293 const nodes = inlineContentToNodes (
298294 [ block . content ] ,
299295 schema ,
300296 type ,
301297 styleSchema ,
302298 ) ;
303- contentNode = schema . nodes [ type ] . createChecked ( block . props as any , nodes ) ;
299+ contentNode = schema . nodes [ type ] . createChecked ( block . props , nodes ) ;
304300 } else if ( Array . isArray ( block . content ) ) {
305301 const nodes = inlineContentToNodes (
306302 block . content ,
307303 schema ,
308304 type ,
309305 styleSchema ,
310306 ) ;
311- contentNode = schema . nodes [ type ] . createChecked ( block . props as any , nodes ) ;
307+ contentNode = schema . nodes [ type ] . createChecked ( block . props , nodes ) ;
312308 } else if ( block . content . type === "tableContent" ) {
313309 const nodes = tableContentToNodes ( block . content , schema , styleSchema ) ;
314- contentNode = schema . nodes [ type ] . createChecked ( block . props as any , nodes ) ;
310+ contentNode = schema . nodes [ type ] . createChecked ( block . props , nodes ) ;
315311 } else {
316312 throw new UnreachableCaseError ( block . content . type ) ;
317313 }
0 commit comments