@@ -33,7 +33,7 @@ import type {
33
33
UnionTypeAnnotation ,
34
34
} from '@babel/types' ;
35
35
36
- const flowTypes = {
36
+ const flowTypes : Record < string , string > = {
37
37
AnyTypeAnnotation : 'any' ,
38
38
BooleanTypeAnnotation : 'boolean' ,
39
39
MixedTypeAnnotation : 'mixed' ,
@@ -50,7 +50,13 @@ const flowLiteralTypes = {
50
50
StringLiteralTypeAnnotation : 1 ,
51
51
} ;
52
52
53
- const namedTypes = {
53
+ const namedTypes : Record <
54
+ string ,
55
+ (
56
+ path : NodePath < any > ,
57
+ typeParams : TypeParameters | null ,
58
+ ) => TypeDescriptor | null
59
+ > = {
54
60
ArrayTypeAnnotation : handleArrayTypeAnnotation ,
55
61
GenericTypeAnnotation : handleGenericTypeAnnotation ,
56
62
ObjectTypeAnnotation : handleObjectTypeAnnotation ,
@@ -420,7 +426,7 @@ function getFlowTypeWithResolvedTypes(
420
426
}
421
427
422
428
if ( path . node . type in flowTypes ) {
423
- type = { name : flowTypes [ path . node . type ] } ;
429
+ type = { name : flowTypes [ path . node . type ] ! } ;
424
430
} else if ( path . node . type in flowLiteralTypes ) {
425
431
type = {
426
432
name : 'literal' ,
@@ -437,7 +443,7 @@ function getFlowTypeWithResolvedTypes(
437
443
} `,
438
444
} ;
439
445
} else if ( path . node . type in namedTypes ) {
440
- type = namedTypes [ path . node . type ] ( path , typeParams ) ;
446
+ type = namedTypes [ path . node . type ] ! ( path , typeParams ) ;
441
447
}
442
448
443
449
if ( ! type ) {
0 commit comments