1
1
/**
2
2
* @typedef {import('unist').Node } Node
3
+ * @typedef {import('unist').Parent } Parent
3
4
*/
4
5
5
6
import test from 'tape'
6
7
import remark from 'remark'
7
8
import { findAfter } from './index.js'
8
9
9
10
var tree = remark ( ) . parse ( 'Some _emphasis_, **importance**, and `code`.' )
11
+ /** @type {Parent } */
12
+ // @ts -expect-error fine.
10
13
var paragraph = tree . children [ 0 ]
11
14
var children = paragraph . children
12
15
13
16
test ( 'unist-util-find-after' , function ( t ) {
14
17
t . throws (
15
18
function ( ) {
16
- // @ts -ignore runtime.
19
+ // @ts -expect-error runtime.
17
20
findAfter ( )
18
21
} ,
19
22
/ E x p e c t e d p a r e n t n o d e / ,
@@ -22,7 +25,7 @@ test('unist-util-find-after', function (t) {
22
25
23
26
t . throws (
24
27
function ( ) {
25
- // @ts -ignore runtime.
28
+ // @ts -expect-error runtime.
26
29
findAfter ( { type : 'foo' } )
27
30
} ,
28
31
/ E x p e c t e d p a r e n t n o d e / ,
@@ -31,7 +34,7 @@ test('unist-util-find-after', function (t) {
31
34
32
35
t . throws (
33
36
function ( ) {
34
- // @ts -ignore runtime.
37
+ // @ts -expect-error runtime.
35
38
findAfter ( { type : 'foo' , children : [ ] } )
36
39
} ,
37
40
/ E x p e c t e d c h i l d n o d e o r i n d e x / ,
@@ -40,7 +43,6 @@ test('unist-util-find-after', function (t) {
40
43
41
44
t . throws (
42
45
function ( ) {
43
- // @ts -ignore runtime.
44
46
findAfter ( { type : 'foo' , children : [ ] } , - 1 )
45
47
} ,
46
48
/ E x p e c t e d p o s i t i v e f i n i t e n u m b e r a s i n d e x / ,
@@ -49,7 +51,6 @@ test('unist-util-find-after', function (t) {
49
51
50
52
t . throws (
51
53
function ( ) {
52
- // @ts -ignore runtime.
53
54
findAfter ( { type : 'foo' , children : [ ] } , { type : 'bar' } )
54
55
} ,
55
56
/ E x p e c t e d c h i l d n o d e o r i n d e x / ,
@@ -61,7 +62,7 @@ test('unist-util-find-after', function (t) {
61
62
findAfter (
62
63
{ type : 'foo' , children : [ { type : 'bar' } , { type : 'baz' } ] } ,
63
64
0 ,
64
- // @ts -ignore runtime.
65
+ // @ts -expect-error runtime.
65
66
false
66
67
)
67
68
} ,
@@ -74,7 +75,7 @@ test('unist-util-find-after', function (t) {
74
75
findAfter (
75
76
{ type : 'foo' , children : [ { type : 'bar' } , { type : 'baz' } ] } ,
76
77
0 ,
77
- // @ts -ignore runtime.
78
+ // @ts -expect-error runtime.
78
79
true
79
80
)
80
81
} ,
0 commit comments