code: def type_map_reducer(map_: TypeMap, type_: GraphQLNamedType = None) -> TypeMap:
      
      if not type_:
          return map_
      if is_wrapping_type(type_):
          return type_map_reducer(
              map_, cast(GraphQLWrappingType[GraphQLNamedType], type_).of_type
          )
      name = type_.name
      if name in map_:
          if map_[name] is not type_:
              raise TypeError(
                  "Schema must contain uniquely named types but contains multiple"
                  f" types named {name!r}."
              )
          return map_
      map_[name] = type_
  
      if is_union_type(type_):
          type_ = cast(GraphQLUnionType, type_)
          map_ = type_map_reduce(type_.types, map_)
  
      if is_object_type(type_):
          type_ = cast(GraphQLObjectType, type_)
          map_ = type_map_reduce(type_.interfaces, map_)
  
      if is_object_type(type_) or is_interface_type(type_):
          for field in cast(GraphQLInterfaceType, type_).fields.values():
              args = field.args
              if args:
                  types = [arg.type for arg in args.values()]
                  map_ = type_map_reduce(types, map_)
              map_ = type_map_reducer(map_, field.type)
  
      if is_input_object_type(type_):
          for field in cast(GraphQLInputObjectType, type_).fields.values():
              map_ = type_map_reducer(map_, field.type)
  
      return map_
docs: Reducer function for creating the type map from given types.