4
4
* @typedef {import('hast').Element } Element
5
5
*
6
6
* @typedef {string } TagName
7
+ * @typedef {null|undefined|TagName|TestFunctionAnything|Array.<TagName|TestFunctionAnything> } Test
7
8
*/
8
9
9
10
/**
@@ -56,7 +57,7 @@ export const isElement =
56
57
*
57
58
* @type {(
58
59
* (<T extends Element>(node: unknown, test: T['tagName']|TestFunctionPredicate<T>|Array.<T['tagName']|TestFunctionPredicate<T>>, index?: number, parent?: Parent, context?: unknown) => node is T) &
59
- * ((node?: unknown, test?: null|undefined|TagName|TestFunctionAnything|Array.<TagName|TestFunctionAnything> , index?: number, parent?: Parent, context?: unknown) => boolean)
60
+ * ((node?: unknown, test?: Test , index?: number, parent?: Parent, context?: unknown) => boolean)
60
61
* )}
61
62
*/
62
63
(
@@ -65,8 +66,7 @@ export const isElement =
65
66
* When a `parent` node is known the `index` of node should also be given.
66
67
*
67
68
* @param {unknown } [node] Node to check
68
- * @param {null|undefined|TagName|TestFunctionAnything|Array.<TagName|TestFunctionAnything> } [test]
69
- * When nullish, checks if `node` is a `Node`.
69
+ * @param {Test } [test] When nullish, checks if `node` is a `Node`.
70
70
* When `string`, works like passing `function (node) {return node.type === test}`.
71
71
* When `function` checks if function passed the node is true.
72
72
* When `array`, checks any one of the subtests pass.
@@ -117,13 +117,13 @@ export const convertElement =
117
117
/**
118
118
* @type {(
119
119
* (<T extends Element>(test: T['tagName']|TestFunctionPredicate<T>) => AssertPredicate<T>) &
120
- * ((test?: null|undefined|TagName|TestFunctionAnything|Array.<TagName|TestFunctionAnything> ) => AssertAnything)
120
+ * ((test?: Test ) => AssertAnything)
121
121
* )}
122
122
*/
123
123
(
124
124
/**
125
125
* Generate an assertion from a check.
126
- * @param {null|undefined|TagName|TestFunctionAnything|Array.<TagName|TestFunctionAnything> } [test]
126
+ * @param {Test } [test]
127
127
* When nullish, checks if `node` is a `Node`.
128
128
* When `string`, works like passing `function (node) {return node.type === test}`.
129
129
* When `function` checks if function passed the node is true.
0 commit comments