2727 * @returns {element is X }
2828 */
2929
30+ /**
31+ * Check if a node is an element and passes a certain node test
32+ *
33+ * @callback AssertAnything
34+ * @param {unknown } [node]
35+ * @param {number } [index]
36+ * @param {Parent } [parent]
37+ * @returns {boolean }
38+ */
39+
3040/**
3141 * Check if a node is an element and passes a certain node test
3242 *
@@ -46,7 +56,7 @@ export const isElement =
4656 *
4757 * @type {(
4858 * (<T extends Element>(node: unknown, test: T['tagName']|TestFunctionPredicate<T>|Array.<T['tagName']|TestFunctionPredicate<T>>, index?: number, parent?: Parent, context?: unknown) => node is T) &
49- * ((node?: unknown, test?: null|undefined|TagName|TestFunctionAnything|Array.<TagName|TestFunctionAnything>, index?: number, parent?: Parent, context?: unknown) => node is Element )
59+ * ((node?: unknown, test?: null|undefined|TagName|TestFunctionAnything|Array.<TagName|TestFunctionAnything>, index?: number, parent?: Parent, context?: unknown) => boolean )
5060 * )}
5161 */
5262 (
@@ -107,7 +117,7 @@ export const convertElement =
107117 /**
108118 * @type {(
109119 * (<T extends Element>(test: T['tagName']|TestFunctionPredicate<T>) => AssertPredicate<T>) &
110- * ((test?: null|undefined|TagName|TestFunctionAnything|Array.<TagName|TestFunctionAnything>) => AssertPredicate<Element> )
120+ * ((test?: null|undefined|TagName|TestFunctionAnything|Array.<TagName|TestFunctionAnything>) => AssertAnything )
111121 * )}
112122 */
113123 (
@@ -119,7 +129,7 @@ export const convertElement =
119129 * When `function` checks if function passed the node is true.
120130 * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
121131 * When `array`, checks any one of the subtests pass.
122- * @returns {AssertPredicate<Element> }
132+ * @returns {AssertAnything }
123133 */
124134 function ( test ) {
125135 if ( test === undefined || test === null ) {
@@ -144,10 +154,10 @@ export const convertElement =
144154
145155/**
146156 * @param {Array.<TagName|TestFunctionAnything> } tests
147- * @returns {AssertPredicate<Element> }
157+ * @returns {AssertAnything }
148158 */
149159function anyFactory ( tests ) {
150- /** @type {Array.<AssertPredicate<Element> > } */
160+ /** @type {Array.<AssertAnything > } */
151161 var checks = [ ]
152162 var index = - 1
153163
@@ -160,7 +170,7 @@ function anyFactory(tests) {
160170 /**
161171 * @this {unknown}
162172 * @param {unknown[] } parameters
163- * @returns {node is Element }
173+ * @returns {boolean }
164174 */
165175 function any ( ...parameters ) {
166176 var index = - 1
@@ -180,14 +190,14 @@ function anyFactory(tests) {
180190 * name for said string.
181191 *
182192 * @param {TagName } check
183- * @returns {AssertPredicate<Element> }
193+ * @returns {AssertAnything }
184194 */
185195function tagNameFactory ( check ) {
186196 return tagName
187197
188198 /**
189199 * @param {Node } node
190- * @returns {node is Element }
200+ * @returns {boolean }
191201 */
192202 function tagName ( node ) {
193203 return element ( node ) && node . tagName === check
@@ -196,7 +206,7 @@ function tagNameFactory(check) {
196206
197207/**
198208 * @param {TestFunctionAnything } check
199- * @returns {AssertPredicate<Element> }
209+ * @returns {AssertAnything }
200210 */
201211function castFactory ( check ) {
202212 return assertion
@@ -205,7 +215,7 @@ function castFactory(check) {
205215 * @this {unknown}
206216 * @param {Node } node
207217 * @param {Array.<unknown> } parameters
208- * @returns {node is Element }
218+ * @returns {boolean }
209219 */
210220 function assertion ( node , ...parameters ) {
211221 return element ( node ) && Boolean ( check . call ( this , node , ...parameters ) )
@@ -215,7 +225,7 @@ function castFactory(check) {
215225/**
216226 * Utility to return true if this is an element.
217227 * @param {unknown } node
218- * @returns {node is Element }
228+ * @returns {boolean }
219229 */
220230function element ( node ) {
221231 return Boolean (
0 commit comments