Skip to content

Commit 7ed7d8b

Browse files
committed
Fix types
1 parent c5406d5 commit 7ed7d8b

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

index.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/**
22
* @typedef {import('unist').Node} Node
3-
* @typedef {import('unist-util-visit').Type} Type
4-
* @typedef {import('unist-util-visit').Props} Props
5-
* @typedef {import('unist-util-visit').TestFunctionAnything} TestFunctionAnything
3+
* @typedef {import('unist-util-visit').Test} Test
64
*
75
* @typedef {(node: Node) => unknown} KeyFunction
86
*/
@@ -13,7 +11,7 @@ export class Index {
1311
/**
1412
* @param {string|KeyFunction} prop
1513
* @param {Node} [tree]
16-
* @param {null|undefined|Type|Props|TestFunctionAnything|Array<Type|Props|TestFunctionAnything>} [test]
14+
* @param {Test} [test]
1715
*/
1816
constructor(prop, tree, test) {
1917
/** @type {Map.<unknown, Array.<Node>>} */

test.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/**
2+
* @typedef {import('./index.js').Node} Node
23
* @typedef {import('./index.js').KeyFunction} KeyFunction
3-
* @typedef {import('./index.js').TestFunctionAnything} TestFunctionAnything
4+
* @typedef {import('./index.js').Test} Test
45
*/
56

67
import test from 'tape'
@@ -53,7 +54,7 @@ test('Index', function (t) {
5354
return node.id
5455
}
5556

56-
/** @type {TestFunctionAnything} */
57+
/** @param {Node} node */
5758
function filter(node) {
5859
return node.type === 'a'
5960
}
@@ -200,7 +201,11 @@ test('index.get', function (t) {
200201
sst.deepEqual(index.get('bar'), [select('node[word="bar"]', ast)])
201202
sst.end()
202203

203-
/** @type {TestFunctionAnything} */
204+
/**
205+
* @param {Node} node
206+
* @param {number} index
207+
* @param {Node} parent
208+
*/
204209
function filter(node, index, parent) {
205210
return 'word' in node && index < 2 && parent.type === 'root'
206211
}

0 commit comments

Comments
 (0)