@@ -855,20 +855,23 @@ export class BaseResolversVisitor<
855855 }
856856
857857 const allSchemaTypes = this . _schema . getTypeMap ( ) ;
858+ const typeNames = this . _federation . filterTypeNames ( Object . keys ( allSchemaTypes ) ) ;
859+
860+ const unionTypes = typeNames . reduce ( ( res , typeName ) => {
861+ const schemaType = allSchemaTypes [ typeName ] ;
858862
859- const unionTypes = Object . entries ( allSchemaTypes ) . reduce ( ( res , [ typeName , schemaType ] ) => {
860863 if ( isUnionType ( schemaType ) ) {
861864 const referencedTypes = schemaType . getTypes ( ) . map ( unionMemberType => {
862865 const isUnionMemberMapped = this . config . mappers [ unionMemberType . name ] ;
863866
864- // 1. If mapped without plachoder , just use it without doing extra checks
867+ // 1. If mapped without placehoder , just use it without doing extra checks
865868 if ( isUnionMemberMapped && ! hasPlaceholder ( isUnionMemberMapped . type ) ) {
866869 return isUnionMemberMapped . type ;
867870 }
868871
869872 // 2. Work out value for union member type
870873 // 2a. By default, use the typescript type
871- let unionMemberValue = this . convertName ( unionMemberType . name ) ;
874+ let unionMemberValue = this . convertName ( unionMemberType . name , { } , true ) ;
872875
873876 // 2b. Find fields to Omit if needed.
874877 // - If no field to Omit, "type with maybe Omit" is typescript type i.e. no Omit
@@ -889,7 +892,6 @@ export class BaseResolversVisitor<
889892 // 2d. If has default mapper with placeholder, use the "type with maybe Omit" as {T}
890893 const hasDefaultMapper = ! ! this . config . defaultMapper ?. type ;
891894 const isScalar = this . config . scalars [ typeName ] ;
892-
893895 if ( hasDefaultMapper && hasPlaceholder ( this . config . defaultMapper . type ) ) {
894896 const finalTypename = isScalar ? this . _getScalar ( typeName ) : unionMemberValue ;
895897 return replacePlaceholder ( this . config . defaultMapper . type , finalTypename ) ;
0 commit comments