Skip to content

Commit e85b3f4

Browse files
committed
Change types to use mdast types
1 parent 492084a commit e85b3f4

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @typedef {import('unist').Node} Node
2+
* @typedef {import('mdast').Root|import('mdast').Content} Node
33
* @typedef {import('mdast').Definition} Definition
44
* @typedef {import('unist-util-visit').Visitor<Definition>} DefinitionVisitor
55
*/

test.js

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @typedef {import('unist').Node} Node
2+
* @typedef {import('mdast').Root|import('mdast').Content} Node
33
*/
44

55
import test from 'tape'
@@ -12,14 +12,16 @@ test('mdast-util-definitions', (t) => {
1212

1313
t.throws(
1414
() => {
15-
// @ts-ignore runtime
15+
// @ts-expect-error runtime
1616
definitions()
1717
},
1818
/mdast-util-definitions expected node/,
1919
'should fail without node'
2020
)
2121

22-
tree = remark().parse('[example]: https://example.com "Example"')
22+
tree = /** @type {Node} */ (
23+
remark().parse('[example]: https://example.com "Example"')
24+
)
2325

2426
t.deepLooseEqual(
2527
definitions(tree)('example'),
@@ -39,7 +41,9 @@ test('mdast-util-definitions', (t) => {
3941

4042
t.equal(definitions(tree)('foo'), null, 'should return null when not found')
4143

42-
tree = remark().parse('[__proto__]: https://proto.com "Proto"')
44+
tree = /** @type {Node} */ (
45+
remark().parse('[__proto__]: https://proto.com "Proto"')
46+
)
4347

4448
t.deepLooseEqual(
4549
definitions(tree)('__proto__'),
@@ -69,8 +73,8 @@ test('mdast-util-definitions', (t) => {
6973
'should work on weird identifiers when not found'
7074
)
7175

72-
tree = remark().parse(
73-
'[example]: https://one.com\n[example]: https://two.com'
76+
tree = /** @type {Node} */ (
77+
remark().parse('[example]: https://one.com\n[example]: https://two.com')
7478
)
7579

7680
const example = definitions(tree)('example')

0 commit comments

Comments
 (0)