All Tools/
GraphQL to TypeScript
100% Local•Zero Data Sent
GraphQL SDLTypeScript 5.xZero Overhead

GraphQL Schema to TypeScript Types Generator

Convert GraphQL schema definitions (SDL) into strongly typed TypeScript interfaces and type aliases instantly. Includes support for field arguments, unions, custom scalars, enums, directives, and JSDoc annotations.

Quick Samples:
GraphQL Schema (SDL)
141 lines•2375 chars
Generated TypeScript Types4.69ms
188 TS lines•3845 characters
Ready for Next.js, React, Node, Apollo, URQL
Object Types9type / interface
Interfaces2abstract contracts
Enums2enum format
Unions1polymorphic types
Inputs2mutation payloads
Custom Scalars2mapped types

Zero Dependencies & Instant

Computes 100% inside your browser using a custom lightweight GraphQL Lexer & AST parser. No heavy bundler compilation or CLI installations required.

100% Client-Side Privacy

Your schema definitions, proprietary models, and business domain objects never leave your browser. Zero server uploads and zero telemetry tracking.

Production-Ready Output

Generates clean TypeScript code that integrates immediately with Apollo Client, GraphQL Code Generator, urql, Relay, or native fetch query wrappers.

GraphQL to TypeScript Type Mapping Rules

GraphQL SDL ConstructTypeScript TranslationExplanation & Practical Use
type User { id: ID! }interface User { id: string; }Object types become TypeScript interfaces or type aliases with strongly typed properties.
String! (Non-Null)stringGuaranteed to exist. Never null or undefined.
String (Nullable)string | null | undefinedIn GraphQL, all unadorned types are nullable by default.
[String!]!string[]Non-nullable list containing non-nullable strings.
[String](string | null)[] | nullNullable list where each element can also be null.
union SearchResult = User | Posttype SearchResult = User | Post;Polymorphic unions map directly to TypeScript union types with discriminated unions.
enum Role { ADMIN, USER }enum Role { ADMIN = 'ADMIN' }Converted to TS enum, string union ('ADMIN' | 'USER'), or const object per settings.
field(limit: Int): [Post]UserPostsArgs { limit?: number | null }Field arguments are isolated into strongly-typed parameter interfaces.

Frequently Asked Questions

Why choose interfaces over type aliases for GraphQL types?

TypeScript interfaces support recursive definitions, declaration merging, and native extension syntax (extends), which closely models GraphQL interface implementations. However, if you prefer pure types, you can toggle the Declaration setting to type.

How are GraphQL custom scalars resolved?

Common scalars like DateTime, JSON, UUID, and Upload are automatically mapped to standard TypeScript equivalents. You can add or modify any custom scalar mapping in the Type Options panel above.

Does this generator support field directives and deprecation?

Yes! Directives such as @deprecated(reason: "...") are recognized and automatically transformed into JSDoc @deprecated comments so VS Code and IDEs display strikethrough notices during development.

Is my schema data private and safe?

Completely. The entire conversion runs locally inside your browser via client-side JavaScript. No API calls or background telemetry are transmitted to any server.