Q18: What is the `__typename` field used for?

Difficulty:IntermediateTopic:Caching & Tooling

__typename is a reserved introspection field accessible on any GraphQL type. It returns a string containing the exact runtime object type name. It is heavily utilized by client libraries (like Apollo Client and Relay) for cache normalization and type identification on unions and interfaces.

Key Takeaways
  • __typename reveals the concrete type of an object at runtime.
  • Normalizing client caches requires __typename alongside unique identifiers.
Knowledge Check

Which system component relies heavily on `__typename` for normalizing cache objects?