GraphQL SDL to TypeScript types
Convert a GraphQL schema into matching TypeScript types, interfaces and enums.
GraphQL SDL to TypeScript types
Paste a GraphQL schema definition language (SDL) document — the type, input, interface and enum declarations that describe a GraphQL API — and this tool generates the matching TypeScript types. Backend teams building a GraphQL server, or frontend teams consuming one without codegen tooling installed, get typed shapes for every object, input and interface in the schema in a single pass, without wiring up a build step just to see what the types look like.
Scalar mapping follows the GraphQL spec by default: ID and String become string, Int and Float become number, Boolean stays boolean, and any custom scalar — DateTime, JSON, Upload — falls back to a configurable type you choose. Nullable fields can render as an optional property (field?: Type) or as an explicit union with null (field: Type | null), and the same choice of shape applies to whole declarations: pick TypeScript type aliases or interfaces, with implements turning into extends when interfaces are selected. Enums generate either a string-literal union or a real TypeScript enum. A name prefix or suffix keeps generated names from colliding with hand-written ones, comments and "description" blocks from the schema carry over as JSDoc, and types whose name starts with an underscore — GraphQL's own introspection types — are skipped by default.
Field arguments and directives are stripped automatically, since TypeScript types describe shape rather than resolvers: "field(id: ID!): User @deprecated" becomes a plain field. Nested list types like [String!]! keep their inner and outer nullability independent, so a non-null list of nullable strings and a nullable list of non-null strings come out differently. Declarations can also be sorted alphabetically instead of following the schema's original order.
Everything runs locally in your browser — the schema you paste is never uploaded anywhere. Copy the generated types, download them as a .txt file, or send the output straight back into the input to keep refining the schema.