@@ -341,7 +341,9 @@ module.exports = function() {
341
341
// class Foo { prop: T }
342
342
// var Foo = class { prop: T }
343
343
if (
344
- ( path . isClassMethod ( ) || path . isClassProperty ( ) || path . isTSDeclareMethod ( ) ) &&
344
+ ( path . isClassMethod ( ) ||
345
+ path . isClassProperty ( ) ||
346
+ path . isTSDeclareMethod ( ) ) &&
345
347
path . parentPath . isClassBody ( ) &&
346
348
path . parentPath . parentPath . isClass ( )
347
349
) {
@@ -402,7 +404,11 @@ module.exports = function() {
402
404
const objectKeys = [ ] ;
403
405
404
406
while ( ! objectParent . isStatement ( ) ) {
405
- if ( objectParent . isObjectProperty ( ) || objectParent . isObjectTypeProperty ( ) || objectParent . isTSPropertySignature ( ) ) {
407
+ if (
408
+ objectParent . isObjectProperty ( ) ||
409
+ objectParent . isObjectTypeProperty ( ) ||
410
+ objectParent . isTSPropertySignature ( )
411
+ ) {
406
412
objectKeys . unshift ( objectParent . node . key . name ) ;
407
413
}
408
414
@@ -413,15 +419,18 @@ module.exports = function() {
413
419
findLendsIdentifiers ( objectParent . get ( 'properties' ) [ 0 ] ) ;
414
420
415
421
if ( lendsIdentifiers ) {
416
- return inferMembershipFromIdentifiers ( comment , [ ...lendsIdentifiers , ...objectKeys ] ) ;
422
+ return inferMembershipFromIdentifiers ( comment , [
423
+ ...lendsIdentifiers ,
424
+ ...objectKeys
425
+ ] ) ;
417
426
} else if ( objectParent . parentPath . isAssignmentExpression ( ) ) {
418
427
// Foo = { ... };
419
428
// Foo.prototype = { ... };
420
429
// Foo.bar = { ... };
421
- return inferMembershipFromIdentifiers (
422
- comment ,
423
- [ ...extractIdentifiers ( objectParent . parentPath . get ( 'left' ) ) , ... objectKeys ]
424
- ) ;
430
+ return inferMembershipFromIdentifiers ( comment , [
431
+ ... extractIdentifiers ( objectParent . parentPath . get ( 'left' ) ) ,
432
+ ...objectKeys
433
+ ] ) ;
425
434
} else if ( objectParent . parentPath . isVariableDeclarator ( ) ) {
426
435
// var Foo = { ... };
427
436
return inferMembershipFromIdentifiers ( comment , [
@@ -434,20 +443,23 @@ module.exports = function() {
434
443
inferModuleName ( currentModule || comment ) ,
435
444
...objectKeys
436
445
] ) ;
437
- } else if ( objectParent . parentPath . isTypeAlias ( ) || objectParent . parentPath . isTSTypeAliasDeclaration ( ) ) {
446
+ } else if (
447
+ objectParent . parentPath . isTypeAlias ( ) ||
448
+ objectParent . parentPath . isTSTypeAliasDeclaration ( )
449
+ ) {
438
450
// type X = { ... }
439
451
return inferMembershipFromIdentifiers ( comment , [
440
452
objectParent . parentPath . node . id . name ,
441
453
...objectKeys
442
454
] ) ;
443
- } else if ( objectParent . parentPath . isInterfaceDeclaration ( ) || objectParent . parentPath . isTSInterfaceDeclaration ( ) ) {
455
+ } else if (
456
+ objectParent . parentPath . isInterfaceDeclaration ( ) ||
457
+ objectParent . parentPath . isTSInterfaceDeclaration ( )
458
+ ) {
444
459
// interface Foo { ... }
445
460
return inferMembershipFromIdentifiers (
446
461
comment ,
447
- [
448
- ...inferClassMembership ( objectParent . parentPath ) ,
449
- ...objectKeys
450
- ] ,
462
+ [ ...inferClassMembership ( objectParent . parentPath ) , ...objectKeys ] ,
451
463
'instance'
452
464
) ;
453
465
}
0 commit comments