File tree Expand file tree Collapse file tree 1 file changed +15
-12
lines changed Expand file tree Collapse file tree 1 file changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -240,19 +240,22 @@ 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
- && component . node . parent . id . typeAnnotation . typeAnnotation . typeParameters
250
- && (
251
- component . node . parent . id . typeAnnotation . typeAnnotation . typeParameters . type === 'TSTypeParameterInstantiation'
252
- || component . node . parent . id . typeAnnotation . typeAnnotation . typeParameters . type === 'TypeParameterInstantiation'
253
- )
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
254
249
) {
255
- return component . node . parent . id . typeAnnotation . typeAnnotation . typeParameters . params . find (
250
+ return ;
251
+ }
252
+
253
+ const annotationTypeParams = component . node . parent . id . typeAnnotation . typeAnnotation . typeParameters ;
254
+ if ( annotationTypeParams && (
255
+ annotationTypeParams . type === 'TSTypeParameterInstantiation'
256
+ || annotationTypeParams . type === 'TypeParameterInstantiation'
257
+ ) ) {
258
+ return annotationTypeParams . params . find (
256
259
( param ) => param . type === 'TSTypeReference' || param . type === 'GenericTypeAnnotation'
257
260
) ;
258
261
}
You can’t perform that action at this time.
0 commit comments