From bbdb345542d5c39fb76784926440b114b62aef69 Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 8 Dec 2020 17:56:31 +0800 Subject: [PATCH] chore: fix ts error --- tests/shared/demoTest.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/shared/demoTest.ts b/tests/shared/demoTest.ts index 1997cd0e35..162b3c1678 100644 --- a/tests/shared/demoTest.ts +++ b/tests/shared/demoTest.ts @@ -21,6 +21,9 @@ function ariaConvert(wrapper: CheerIO) { const matches = new Map(); function process(entry: CheerIOElement) { + if (entry.type === 'text') { + return; + } const { attribs, children } = entry; if (matches.has(entry)) return; matches.set(entry, true); @@ -31,7 +34,9 @@ function ariaConvert(wrapper: CheerIO) { } // Loop children - if (!children) return; + if (!children) { + return; + } (Array.isArray(children) ? children : [children]).forEach(process); }