|
| 1 | +/** |
| 2 | + * @typedef {import('mdast').Paragraph} Paragraph |
| 3 | + */ |
| 4 | + |
1 | 5 | import test from 'tape'
|
2 |
| -import remark from 'remark' |
| 6 | +import {remark} from 'remark' |
3 | 7 | import {findAllBefore} from './index.js'
|
4 | 8 |
|
5 | 9 | const tree = remark().parse('Some _emphasis_, **importance**, and `code`.')
|
6 |
| -// @ts-expect-error hush. |
7 |
| -const paragraph = tree.children[0] |
| 10 | +const paragraph = /** @type {Paragraph} */ (tree.children[0]) |
8 | 11 | const children = paragraph.children
|
9 | 12 |
|
10 | 13 | test('unist-util-find-all-before', (t) => {
|
@@ -86,31 +89,37 @@ test('unist-util-find-all-before', (t) => {
|
86 | 89 | )
|
87 | 90 |
|
88 | 91 | t.deepEqual(
|
| 92 | + // @ts-expect-error: TypeScript does not understand things. |
89 | 93 | findAllBefore(paragraph, 100, children[0]),
|
90 | 94 | [children[0]],
|
91 | 95 | 'should return `[node]` when given a `node` and existing (#1)'
|
92 | 96 | )
|
93 | 97 | t.deepEqual(
|
| 98 | + // @ts-expect-error: TypeScript does not understand things. |
94 | 99 | findAllBefore(paragraph, children[1], children[0]),
|
95 | 100 | [children[0]],
|
96 | 101 | 'should return `[node]` when given a `node` and existing (#2)'
|
97 | 102 | )
|
98 | 103 | t.deepEqual(
|
| 104 | + // @ts-expect-error: TypeScript does not understand things. |
99 | 105 | findAllBefore(paragraph, 1, children[0]),
|
100 | 106 | [children[0]],
|
101 | 107 | 'should return `[node]` when given a `node` and existing (#3)'
|
102 | 108 | )
|
103 | 109 | t.deepEqual(
|
| 110 | + // @ts-expect-error: TypeScript does not understand things. |
104 | 111 | findAllBefore(paragraph, children[0], children[0]),
|
105 | 112 | [],
|
106 | 113 | 'should return `[node]` when given a `node` and existing (#4)'
|
107 | 114 | )
|
108 | 115 | t.deepEqual(
|
| 116 | + // @ts-expect-error: TypeScript does not understand things. |
109 | 117 | findAllBefore(paragraph, 0, children[0]),
|
110 | 118 | [],
|
111 | 119 | 'should return `[node]` when given a `node` and existing (#5)'
|
112 | 120 | )
|
113 | 121 | t.deepEqual(
|
| 122 | + // @ts-expect-error: TypeScript does not understand things. |
114 | 123 | findAllBefore(paragraph, 1, children[1]),
|
115 | 124 | [],
|
116 | 125 | 'should return `[node]` when given a `node` and existing (#6)'
|
|
0 commit comments