1
1
/**
2
2
* @typedef {import('unist').Node } Node
3
3
* @typedef {import('unist').Parent } Parent
4
- *
5
- * @typedef {string } Type
6
- * @typedef {Record<string, unknown> } Props
7
- * @typedef {import('unist-util-is').TestFunctionAnything } TestFunctionAnything
4
+ * @typedef {import('unist-util-is').Test } Test
8
5
*/
9
6
10
7
import { convert } from 'unist-util-is'
@@ -17,24 +14,25 @@ import {convert} from 'unist-util-is'
17
14
* Parent node.
18
15
* @param index
19
16
* Child of `parent`, or it’s index.
20
- * @param [ test]
17
+ * @param test
21
18
* `unist-util-is`-compatible test.
22
19
* @returns
20
+ * Child of `parent` or `null`.
23
21
*
24
22
*/
25
23
export const findBefore =
26
24
/**
27
25
* @type {(
28
- * (<T extends Node>(node: Parent, index: Node| number, test: T['type']|Partial<T>| import('unist-util-is').TestFunctionPredicate <T>|Array<T['type']|Partial<T>|import('unist-util-is').TestFunctionPredicate<T>>) => T| null) &
29
- * ((node: Parent, index: Node| number, test?: null|undefined|Type|Props|TestFunctionAnything|Array<Type|Props|TestFunctionAnything> ) => Node| null)
26
+ * (<T extends Node>(node: Parent, index: Node | number, test: import('unist-util-is').PredicateTest <T>) => T | null) &
27
+ * ((node: Parent, index: Node | number, test?: Test ) => Node | null)
30
28
* )}
31
29
*/
32
30
(
33
31
/**
34
32
* @param {Parent } parent
35
- * @param {Node| number } index
36
- * @param {null|undefined|Type|Props|TestFunctionAnything|Array<Type|Props|TestFunctionAnything> } [test]
37
- * @returns {Node| null }
33
+ * @param {Node | number } index
34
+ * @param {Test } [test]
35
+ * @returns {Node | null }
38
36
*/
39
37
function ( parent , index , test ) {
40
38
const is = convert ( test )
0 commit comments