Skip to content

Commit 5e98354

Browse files
committed
Add VisitorResult type
1 parent 4270b9d commit 5e98354

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

index.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
/**
22
* @typedef {import('unist').Node} Node
33
* @typedef {import('unist').Parent} Parent
4-
* @typedef {import('unist-util-is').Type} Type
5-
* @typedef {import('unist-util-is').Props} Props
6-
* @typedef {import('unist-util-is').TestFunctionAnything} TestFunctionAnything
7-
* @typedef {import('unist-util-visit-parents').Action} Action
8-
* @typedef {import('unist-util-visit-parents').Index} Index
9-
* @typedef {import('unist-util-visit-parents').ActionTuple} ActionTuple
4+
* @typedef {import('unist-util-is').Test} Test
5+
* @typedef {import('unist-util-visit-parents').VisitorResult} VisitorResult
106
*/
117

128
/**
@@ -25,7 +21,7 @@
2521
* @param {V} node Found node
2622
* @param {number|null} index Position of `node` in `parent`
2723
* @param {Parent|null} parent Parent of `node`
28-
* @returns {null|undefined|Action|Index|ActionTuple|void}
24+
* @returns {VisitorResult}
2925
*/
3026

3127
import {visitParents, CONTINUE, SKIP, EXIT} from 'unist-util-visit-parents'
@@ -36,7 +32,7 @@ export const visit =
3632
/**
3733
* @type {(
3834
* (<T extends Node>(tree: Node, test: T['type']|Partial<T>|import('unist-util-is').TestFunctionPredicate<T>|Array.<T['type']|Partial<T>|import('unist-util-is').TestFunctionPredicate<T>>, visitor: Visitor<T>, reverse?: boolean) => void) &
39-
* ((tree: Node, test: null|undefined|Type|Props|TestFunctionAnything|Array<Type|Props|TestFunctionAnything>, visitor: Visitor<Node>, reverse?: boolean) => void) &
35+
* ((tree: Node, test: Test, visitor: Visitor<Node>, reverse?: boolean) => void) &
4036
* ((tree: Node, visitor: Visitor<Node>, reverse?: boolean) => void)
4137
* )}
4238
*/
@@ -45,7 +41,7 @@ export const visit =
4541
* Visit children of tree which pass a test
4642
*
4743
* @param {Node} tree Abstract syntax tree to walk
48-
* @param {null|undefined|Type|Props|TestFunctionAnything|Array<Type|Props|TestFunctionAnything>} test test Test node
44+
* @param {Test} test test Test node
4945
* @param {Visitor<Node>} visitor Function to run for each node
5046
* @param {boolean} [reverse] Fisit the tree in reverse, defaults to false
5147
*/

0 commit comments

Comments
 (0)