Skip to content

Commit 4f8b023

Browse files
committed
Fix for changes in @types/unist
1 parent eef5536 commit 4f8b023

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ export function raw(tree, file, options) {
123123
}
124124
}
125125

126+
// @ts-expect-error: update `vfile`.
126127
result = fromParse5(documentMode(tree) ? document() : fragment(), file)
127128

128129
if (stitches) {
@@ -359,11 +360,13 @@ export function raw(tree, file, options) {
359360
// Recurse, because to somewhat handle `[<x>]</x>` (where `[]` denotes the
360361
// passed through node).
361362
if ('children' in node) {
363+
// @ts-ignore Assume parent.
362364
clone.children = raw(
363365
// @ts-ignore Assume parent.
364366
{type: 'root', children: node.children},
365367
file,
366368
options
369+
// @ts-ignore Assume parent.
367370
).children
368371
}
369372

@@ -464,7 +467,11 @@ function unknown(node) {
464467
*/
465468
function documentMode(node) {
466469
var head = node.type === 'root' ? node.children[0] : node
467-
return Boolean(head && (head.type === 'doctype' || head.tagName === 'html'))
470+
return Boolean(
471+
head &&
472+
(head.type === 'doctype' ||
473+
(head.type === 'element' && head.tagName === 'html'))
474+
)
468475
}
469476

470477
/**

0 commit comments

Comments
 (0)