@@ -269,7 +269,7 @@ interface ComponentMeta<T> {
269
269
}
270
270
271
271
const componentType = typeChecker . getTypeOfSymbolAtLocation ( _export , symbolNode ) ;
272
- const symbolProperties = componentType . getProperties ( ) ?? [ ] ;
272
+ const symbolProperties = componentType . getProperties ( ) ;
273
273
274
274
let _type : ReturnType < typeof getType > | undefined ;
275
275
let _props : ReturnType < typeof getProps > | undefined ;
@@ -451,7 +451,7 @@ interface ComponentMeta<T> {
451
451
typeChecker : ts . TypeChecker ,
452
452
componentPath : string ,
453
453
) {
454
- const sourceFile = program ? .getSourceFile ( getMetaFileName ( componentPath ) ) ;
454
+ const sourceFile = program . getSourceFile ( getMetaFileName ( componentPath ) ) ;
455
455
if ( ! sourceFile ) {
456
456
throw 'Could not find main source file' ;
457
457
}
@@ -530,8 +530,8 @@ function createSchemaResolvers(
530
530
531
531
function resolveNestedProperties ( prop : ts . Symbol ) : PropertyMeta {
532
532
const subtype = typeChecker . getTypeOfSymbolAtLocation ( prop , symbolNode ) ;
533
- let schema : PropertyMetaSchema ;
534
- let declarations : Declaration [ ] ;
533
+ let schema : PropertyMetaSchema | undefined ;
534
+ let declarations : Declaration [ ] | undefined ;
535
535
536
536
return {
537
537
name : prop . getEscapedName ( ) . toString ( ) ,
@@ -557,8 +557,8 @@ function createSchemaResolvers(
557
557
const signatures = propType . getCallSignatures ( ) ;
558
558
const paramType = signatures [ 0 ] ?. parameters [ 0 ] ;
559
559
const subtype = paramType ? typeChecker . getTypeOfSymbolAtLocation ( paramType , symbolNode ) : typeChecker . getAnyType ( ) ;
560
- let schema : PropertyMetaSchema ;
561
- let declarations : Declaration [ ] ;
560
+ let schema : PropertyMetaSchema | undefined ;
561
+ let declarations : Declaration [ ] | undefined ;
562
562
563
563
return {
564
564
name : prop . getName ( ) ,
@@ -575,8 +575,8 @@ function createSchemaResolvers(
575
575
}
576
576
function resolveExposedProperties ( expose : ts . Symbol ) : ExposeMeta {
577
577
const subtype = typeChecker . getTypeOfSymbolAtLocation ( expose , symbolNode ) ;
578
- let schema : PropertyMetaSchema ;
579
- let declarations : Declaration [ ] ;
578
+ let schema : PropertyMetaSchema | undefined ;
579
+ let declarations : Declaration [ ] | undefined ;
580
580
581
581
return {
582
582
name : expose . getName ( ) ,
@@ -592,8 +592,8 @@ function createSchemaResolvers(
592
592
} ;
593
593
}
594
594
function resolveEventSignature ( call : ts . Signature ) : EventMeta {
595
- let schema : PropertyMetaSchema [ ] ;
596
- let declarations : Declaration [ ] ;
595
+ let schema : PropertyMetaSchema [ ] | undefined ;
596
+ let declarations : Declaration [ ] | undefined ;
597
597
let subtype = undefined ;
598
598
let subtypeStr = '[]' ;
599
599
let getSchema = ( ) => [ ] as PropertyMetaSchema [ ] ;
@@ -666,7 +666,7 @@ function createSchemaResolvers(
666
666
visited . add ( subtype ) ;
667
667
668
668
if ( subtype . isUnion ( ) ) {
669
- let schema : PropertyMetaSchema [ ] ;
669
+ let schema : PropertyMetaSchema [ ] | undefined ;
670
670
return {
671
671
kind : 'enum' ,
672
672
type,
@@ -676,7 +676,7 @@ function createSchemaResolvers(
676
676
} ;
677
677
}
678
678
else if ( typeChecker . isArrayLikeType ( subtype ) ) {
679
- let schema : PropertyMetaSchema [ ] ;
679
+ let schema : PropertyMetaSchema [ ] | undefined ;
680
680
return {
681
681
kind : 'array' ,
682
682
type,
@@ -690,7 +690,7 @@ function createSchemaResolvers(
690
690
&& ( subtype . isClassOrInterface ( ) || subtype . isIntersection ( )
691
691
|| ( subtype as ts . ObjectType ) . objectFlags & ts . ObjectFlags . Anonymous )
692
692
) {
693
- let schema : Record < string , PropertyMeta > ;
693
+ let schema : Record < string , PropertyMeta > | undefined ;
694
694
return {
695
695
kind : 'object' ,
696
696
type,
@@ -939,7 +939,7 @@ function resolvePropsOption(
939
939
940
940
for ( const prop of props . properties ) {
941
941
if ( ts . isPropertyAssignment ( prop ) ) {
942
- const name = prop . name ? .getText ( ast ) ;
942
+ const name = prop . name . getText ( ast ) ;
943
943
if ( ts . isObjectLiteralExpression ( prop . initializer ) ) {
944
944
const defaultProp = prop . initializer . properties . find ( p =>
945
945
ts . isPropertyAssignment ( p ) && p . name . getText ( ast ) === 'default'
0 commit comments