Closes GH-2. Closes GH-3.
Reviewed-by: Christian Murphy <christian.murphy.42@gmail.com> Reviewed-by: Titus Wormer <tituswormer@gmail.com>
7 | 7 | * @typedef {null|undefined|TagName|TestFunctionAnything|Array.<TagName|TestFunctionAnything>} Test |
|
8 | 8 | */ |
|
9 | 9 | ||
10 | + | /** |
|
11 | + | * @template {Element} T |
|
12 | + | * @typedef {null|undefined|T['tagName']|TestFunctionPredicate<T>|Array.<T['tagName']|TestFunctionPredicate<T>>} PredicateTest |
|
13 | + | */ |
|
14 | + | ||
10 | 15 | /** |
|
11 | 16 | * Check if an element passes a test |
|
12 | 17 | * |
22 | 27 | * |
|
23 | 28 | * @template {Element} X |
|
24 | 29 | * @callback TestFunctionPredicate |
|
25 | - | * @param {X} element |
|
30 | + | * @param {Element} element |
|
26 | 31 | * @param {number|null|undefined} [index] |
|
27 | 32 | * @param {Parent|null|undefined} [parent] |
|
28 | 33 | * @returns {element is X} |
56 | 61 | * When a `parent` node is known the `index` of node should also be given. |
|
57 | 62 | * |
|
58 | 63 | * @type {( |
|
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) & |
|
60 | - | * ((node?: unknown, test?: Test, index?: number, parent?: Parent, context?: unknown) => boolean) |
|
64 | + | * (() => false) & |
|
65 | + | * (<T extends Element = Element>(node: unknown, test?: PredicateTest<T>, index?: number, parent?: Parent, context?: unknown) => node is T) & |
|
66 | + | * ((node: unknown, test: Test, index?: number, parent?: Parent, context?: unknown) => boolean) |
|
61 | 67 | * )} |
|
62 | 68 | */ |
|
63 | 69 | ( |
Files | Coverage |
---|---|
index.js | 100.00% |
Project Totals (1 files) | 100.00% |