@@ -240,27 +240,25 @@ module.exports = {
240
240
}
241
241
242
242
if (
243
- component . node . parent
244
- && component . node . parent . type === 'VariableDeclarator'
245
- && component . node . parent . id
246
- && component . node . parent . id . type === 'Identifier'
247
- && component . node . parent . id . typeAnnotation
248
- && component . node . parent . id . typeAnnotation . typeAnnotation
249
- && (
250
- ( component . node . parent . id . typeAnnotation . typeAnnotation . typeArguments
251
- && (
252
- component . node . parent . id . typeAnnotation . typeAnnotation . typeArguments . type === 'TSTypeParameterInstantiation'
253
- || component . node . parent . id . typeAnnotation . typeAnnotation . typeArguments . type === 'TypeParameterInstantiation'
254
- ) )
255
- || ( component . node . parent . id . typeAnnotation . typeAnnotation . typeParameters
256
- && ( component . node . parent . id . typeAnnotation . typeAnnotation . typeParameters . type === 'TSTypeParameterInstantiation'
257
- || component . node . parent . id . typeAnnotation . typeAnnotation . typeParameters . type === 'TypeParameterInstantiation'
258
- ) )
259
- )
243
+ ! component . node . parent
244
+ || component . node . parent . type !== 'VariableDeclarator'
245
+ || ! component . node . parent . id
246
+ || component . node . parent . id . type !== 'Identifier'
247
+ || ! component . node . parent . id . typeAnnotation
248
+ || ! component . node . parent . id . typeAnnotation . typeAnnotation
260
249
) {
261
- return component . node . parent . id . typeAnnotation . typeAnnotation . typeParameters . params . find (
262
- ( param ) => param . type === 'TSTypeReference' || param . type === 'GenericTypeAnnotation'
263
- ) ;
250
+ return ;
251
+ }
252
+
253
+ const annotationArgs = component . node . parent . id . typeAnnotation . typeAnnotation . typeArguments
254
+ || component . node . parent . id . typeAnnotation . typeAnnotation . typeParameters ;
255
+ if (
256
+ annotationArgs
257
+ && ( annotationArgs . type === 'TSTypeParameterInstantiation' || annotationArgs . type === 'TypeParameterInstantiation' )
258
+ ) {
259
+ return annotationArgs . params . find ( ( param ) => (
260
+ param . type === 'TSTypeReference' || param . type === 'GenericTypeAnnotation'
261
+ ) ) ;
264
262
}
265
263
}
266
264
0 commit comments