Skip to content

Commit ba43556

Browse files
authored
fix: missing type import
1 parent a12b35d commit ba43556

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/normalize.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
export function normalize(node) {
2-
if (!node.children) return node;
1+
import type { CommentNode, DocumentNode, ElementNode, TextNode } from "@homebots/parse-html";
2+
3+
export function normalize(node: ElementNode | DocumentNode | CommentNode | TextNode) {
4+
if ('children' in node === false) {
5+
return node;
6+
}
37

48
node.children = node.children.filter((child) => {
5-
if (child.type === 'text' && child.text.trim() === '') {
9+
if (child.type === "text" && child.text.trim() === "") {
610
return false;
711
}
812

src/serialize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ParserNode } from './types';
1+
import type { ParserNode } from "@homebots/parse-html";
22

33
export function serialize(node: ParserNode) {
44
switch (node.type) {

0 commit comments

Comments
 (0)