Skip to content
100% local

GraphQL SDL to TypeScript types

Convert a GraphQL schema into matching TypeScript types, interfaces and enums.

Input
Output

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.

FAQ

Does it handle nested list and non-null modifiers like [String!]!?
Yes. Each level of nullability — the list itself and its elements — is mapped independently, so [String!]! becomes string[] while [String] becomes (string | null)[].
What happens to custom scalars like DateTime or JSON?
They map to the fallback type set in the "Custom scalar type" option (unknown by default). Set it to string, Date or any other matching type and every field using that scalar picks it up.
Are field arguments and directives kept in the output?
No. TypeScript types only describe shape, so arguments like (limit: Int) and directives like @deprecated are dropped; the field itself still converts normally.
Can I generate interfaces instead of type aliases?
Yes. Switch "Declaration kind" to Interfaces, and any implements clause on a GraphQL type becomes an extends clause on the TypeScript interface.
Is my schema uploaded anywhere?
No. Conversion runs entirely in your browser — your GraphQL schema never leaves your device.