Generate TypeScript Types from GraphQL
Paste a GraphQL schema in SDL format (type, input, enum blocks) to automatically generate the matching TypeScript interfaces and types, with scalar conversion and optional field handling.
How It Works
The tool spots each type, input, or enum block in the schema using regular expressions, then converts each field into a TypeScript property: standard GraphQL scalars (ID, String, Int, Float, Boolean) are mapped to their TypeScript equivalent, and custom types are kept as-is as references to other generated interfaces.
How is GraphQL nullability translated?
In GraphQL, a field is nullable by default; only the ! suffix makes it required. The tool translates this rule into TypeScript: a field without ! becomes an optional property (field?: type), while a field with ! remains required.
Are GraphQL lists converted correctly?
Yes: [String!]! becomes string[] (a required array of required strings), while [String] becomes a potentially absent optional array string[], respecting the position of exclamation points in the source type.
Privacy: your GraphQL schema is analyzed locally using regular expressions, never leaving your browser.