addedTo static method

TypeDefinition? addedTo(
  1. TypeDefinition? definition,
  2. ResolveType getType
)

Saturates the definition with a getType if it extends from TypeResolver

Implementation

static TypeDefinition? addedTo(
  TypeDefinition? definition,
  ResolveType getType,
) {
  if (definition == null) {
    return null;
  }
  if (definition is InterfaceTypeDefinition) {
    return InterfaceTypeDefinition(definition.astNode, getType);
  }
  if (definition is ObjectTypeDefinition) {
    return ObjectTypeDefinition(definition.astNode, getType);
  }
  if (definition is UnionTypeDefinition) {
    return UnionTypeDefinition(definition.astNode, getType);
  }

  if (definition is InputObjectTypeDefinition) {
    return InputObjectTypeDefinition(definition.astNode, getType);
  }

  return null;
}