File tree 1 file changed +9
-7
lines changed
packages/eslint-plugin/src/rules
1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -302,16 +302,18 @@ export default createRule<Options, MessageIds>({
302
302
: undefined ;
303
303
}
304
304
305
- function isThisParam (
306
- param : TSESTree . Parameter | undefined ,
307
- ) : param is TSESTree . Identifier {
308
- return param ?. type === AST_NODE_TYPES . Identifier && param . name === 'this' ;
305
+ function isThisParam ( param : TSESTree . Parameter | undefined ) : boolean {
306
+ return (
307
+ param != null &&
308
+ param . type === AST_NODE_TYPES . Identifier &&
309
+ param . name === 'this'
310
+ ) ;
309
311
}
310
312
311
313
function isThisVoidParam ( param : TSESTree . Parameter | undefined ) {
312
314
return (
313
315
isThisParam ( param ) &&
314
- param . typeAnnotation ?. typeAnnotation . type ===
316
+ ( param as TSESTree . Identifier ) . typeAnnotation ?. typeAnnotation . type ===
315
317
AST_NODE_TYPES . TSVoidKeyword
316
318
) ;
317
319
}
@@ -332,8 +334,8 @@ export default createRule<Options, MessageIds>({
332
334
const shorter = sig1 . length < sig2 . length ? sig1 : sig2 ;
333
335
const shorterSig = sig1 . length < sig2 . length ? a : b ;
334
336
335
- const firstParam1 = sig1 [ 0 ] ;
336
- const firstParam2 = sig2 [ 0 ] ;
337
+ const firstParam1 = sig1 . at ( 0 ) ;
338
+ const firstParam2 = sig2 . at ( 0 ) ;
337
339
// If one signature has explicit this type and another doesn't, they can't
338
340
// be unified.
339
341
if ( isThisParam ( firstParam1 ) !== isThisParam ( firstParam2 ) ) {
You can’t perform that action at this time.
0 commit comments