@@ -83,7 +83,9 @@ export function safeGetPropertyType(
8383 const propSymbol = checker . getPropertyOfType ( parentType , propName ) ;
8484 if ( propSymbol ) {
8585 typeFromParent = checker . getTypeOfSymbol ( propSymbol ) ;
86- const typeStr = typeFromParent ? checker . typeToString ( typeFromParent ) : undefined ;
86+ const typeStr = typeFromParent
87+ ? checker . typeToString ( typeFromParent )
88+ : undefined ;
8789 // If we got 'any', treat it as if we didn't get a type
8890 if ( typeStr === "any" ) {
8991 typeFromParent = undefined ;
@@ -115,11 +117,13 @@ export function safeGetPropertyType(
115117 // Check if parent is a union that contains undefined, and if removing it gives us the decl type
116118 if ( isOptional && typeFromParent . isUnion ( ) ) {
117119 const parentUnion = typeFromParent as ts . UnionType ;
118- const hasUndefined = parentUnion . types . some ( t => ! ! ( t . flags & ts . TypeFlags . Undefined ) ) ;
120+ const hasUndefined = parentUnion . types . some ( ( t ) =>
121+ ! ! ( t . flags & ts . TypeFlags . Undefined )
122+ ) ;
119123
120124 if ( hasUndefined ) {
121125 const nonUndefinedTypes = parentUnion . types . filter (
122- t => ! ( t . flags & ts . TypeFlags . Undefined )
126+ ( t ) => ! ( t . flags & ts . TypeFlags . Undefined ) ,
123127 ) ;
124128
125129 // Compare the non-undefined part with the declaration type
@@ -133,8 +137,12 @@ export function safeGetPropertyType(
133137 } else if ( nonUndefinedTypes . length > 1 ) {
134138 // Multiple non-undefined types - check if decl is also a union with the same types
135139 // For now, just check string equality which should work for most cases
136- const withoutUndefinedStr = nonUndefinedTypes . map ( t => checker . typeToString ( t ) ) . join ( " | " ) ;
137- if ( withoutUndefinedStr === declStr || declStr === withoutUndefinedStr ) {
140+ const withoutUndefinedStr = nonUndefinedTypes . map ( ( t ) =>
141+ checker . typeToString ( t )
142+ ) . join ( " | " ) ;
143+ if (
144+ withoutUndefinedStr === declStr || declStr === withoutUndefinedStr
145+ ) {
138146 return typeFromDecl ;
139147 }
140148 }
@@ -154,7 +162,7 @@ export function safeGetPropertyType(
154162 if ( isOptional && typeFromParent . isUnion ( ) ) {
155163 const unionType = typeFromParent as ts . UnionType ;
156164 const nonUndefinedTypes = unionType . types . filter (
157- t => ! ( t . flags & ts . TypeFlags . Undefined )
165+ ( t ) => ! ( t . flags & ts . TypeFlags . Undefined ) ,
158166 ) ;
159167 if ( nonUndefinedTypes . length === 1 && nonUndefinedTypes [ 0 ] ) {
160168 return nonUndefinedTypes [ 0 ] ;
0 commit comments