1-
2- import type { Element , Root , Node } from 'hast' ;
1+ import type { Element , Root , Node , Text , ElementContent } from 'hast' ;
32import { rehype } from 'rehype' ;
43
54const isElement = ( node : Node ) : node is Element => node . type === 'element' ;
@@ -35,7 +34,7 @@ export const processAdvanceSteps = (html: string | undefined, split: SplitType)
3534 } else {
3635 // Fallback for 'ol' mode: if content is not a single OL, wrap everything in one step.
3736 if ( tree . children . length > 0 ) {
38- const li : Element = { type : 'element' , tagName : 'li' , properties : { } , children : tree . children } ;
37+ const li : Element = { type : 'element' , tagName : 'li' , properties : { } , children : tree . children as ElementContent [ ] } ;
3938 tree . children = [ {
4039 type : 'element' ,
4140 tagName : 'ol' ,
@@ -56,7 +55,7 @@ export const processAdvanceSteps = (html: string | undefined, split: SplitType)
5655
5756 if ( ! hasSeparators ) {
5857 if ( tree . children . length > 0 ) {
59- const li : Element = { type : 'element' , tagName : 'li' , properties : { } , children : tree . children } ;
58+ const li : Element = { type : 'element' , tagName : 'li' , properties : { } , children : tree . children as ElementContent [ ] } ;
6059 tree . children = [ {
6160 type : 'element' ,
6261 tagName : 'ol' ,
@@ -90,7 +89,7 @@ export const processAdvanceSteps = (html: string | undefined, split: SplitType)
9089 . filter (
9190 ( step ) =>
9291 step . length > 0 &&
93- step . some ( ( node ) => isElement ( node ) || ( node . type === 'text' && node . value . trim ( ) !== '' ) ) ,
92+ step . some ( ( node ) => isElement ( node ) || ( node . type === 'text' && ( node as Text ) . value . trim ( ) !== '' ) ) ,
9493 )
9594 . map ( ( stepNodes ) => {
9695 return {
@@ -114,4 +113,4 @@ export const processAdvanceSteps = (html: string | undefined, split: SplitType)
114113
115114 const file = stepsProcessor . processSync ( { value : html } ) ;
116115 return { html : file . toString ( ) } ;
117- } ;
116+ } ;
0 commit comments