File tree 3 files changed +12
-10
lines changed 3 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ export const isElement =
97
97
throw new Error ( 'Expected parent node' )
98
98
}
99
99
100
- // @ts -ignore Looks like a node.
100
+ // @ts -expect-error Looks like a node.
101
101
if ( ! node || ! node . type || typeof node . type !== 'string' ) {
102
102
return false
103
103
}
@@ -196,7 +196,7 @@ function tagNameFactory(check) {
196
196
return tagName
197
197
198
198
/**
199
- * @param {Node } node
199
+ * @param {unknown } node
200
200
* @returns {boolean }
201
201
*/
202
202
function tagName ( node ) {
@@ -213,11 +213,12 @@ function castFactory(check) {
213
213
214
214
/**
215
215
* @this {unknown}
216
- * @param {Node } node
216
+ * @param {unknown } node
217
217
* @param {Array.<unknown> } parameters
218
218
* @returns {boolean }
219
219
*/
220
220
function assertion ( node , ...parameters ) {
221
+ // @ts -expect-error: fine.
221
222
return element ( node ) && Boolean ( check . call ( this , node , ...parameters ) )
222
223
}
223
224
}
@@ -231,9 +232,9 @@ function element(node) {
231
232
return Boolean (
232
233
node &&
233
234
typeof node === 'object' &&
234
- // @ts -ignore Looks like a node.
235
+ // @ts -expect-error Looks like a node.
235
236
node . type === 'element' &&
236
- // @ts -ignore Looks like an element.
237
+ // @ts -expect-error Looks like an element.
237
238
typeof node . tagName === 'string'
238
239
)
239
240
}
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ test('isElement', (t) => {
12
12
13
13
t . throws (
14
14
( ) => {
15
- // @ts -ignore runtime.
15
+ // @ts -expect-error runtime.
16
16
isElement ( null , true )
17
17
} ,
18
18
/ E x p e c t e d f u n c t i o n , s t r i n g , o r a r r a y a s t e s t / ,
@@ -178,7 +178,7 @@ test('isElement', (t) => {
178
178
179
179
st . throws (
180
180
( ) => {
181
- // @ts -ignore runtime.
181
+ // @ts -expect-error runtime.
182
182
isElement ( root . children [ 0 ] , ( ) => { } , false )
183
183
} ,
184
184
/ E x p e c t e d p o s i t i v e f i n i t e i n d e x f o r c h i l d n o d e / ,
@@ -203,7 +203,7 @@ test('isElement', (t) => {
203
203
204
204
st . throws (
205
205
( ) => {
206
- // @ts -ignore runtime.
206
+ // @ts -expect-error runtime.
207
207
isElement ( root . children [ 0 ] , ( ) => { } , 0 , true )
208
208
} ,
209
209
/ E x p e c t e d p a r e n t n o d e / ,
@@ -212,7 +212,7 @@ test('isElement', (t) => {
212
212
213
213
st . throws (
214
214
( ) => {
215
- // @ts -ignore runtime.
215
+ // @ts -expect-error runtime.
216
216
isElement ( root . children [ 0 ] , ( ) => { } , 0 , { type : 'root' } )
217
217
} ,
218
218
/ E x p e c t e d p a r e n t n o d e / ,
Original file line number Diff line number Diff line change 10
10
"declaration" : true ,
11
11
"emitDeclarationOnly" : true ,
12
12
"allowSyntheticDefaultImports" : true ,
13
- "skipLibCheck" : true
13
+ "skipLibCheck" : true ,
14
+ "strict" : true
14
15
}
15
16
}
You can’t perform that action at this time.
0 commit comments