DevToolBoxGRÁTIS
Blog

GraphQL to TypeScript Converter

Convert GraphQL schema to TypeScript types online. Generate TypeScript interfaces from GraphQL type definitions. Free and instant.

About GraphQL to TypeScript Conversion

GraphQL schemas define the shape of data in your API using SDL (Schema Definition Language). When building TypeScript clients or servers, you need TypeScript types that match your GraphQL schema for type safety. This tool converts GraphQL type definitions to TypeScript interfaces. It handles scalar types (String, Int, Float, Boolean, ID), object types, input types, enums, unions, and list types. Non-null types (!) become required fields, while nullable types become optional. All processing happens locally in your browser.

𝕏 Twitterin LinkedIn

Avalie esta ferramenta

3.9 / 5 · 56 avaliações

Fique atualizado

Receba dicas de dev e novos ferramentas semanalmente.

Sem spam. Cancele a qualquer momento.

Enjoy these free tools?

Buy Me a Coffee

How to Use

  1. Paste your GraphQL schema (SDL) into the input
  2. Toggle the export option if needed
  3. Click Convert to generate TypeScript types
  4. Copy the types into your TypeScript project

Common Use Cases

  • Generating TypeScript types from GraphQL API schemas
  • Building type-safe GraphQL clients
  • Creating shared types between GraphQL server and client
  • Documenting API types for TypeScript projects

Frequently Asked Questions

What GraphQL types are supported?
The tool supports type, input, enum, scalar, and union definitions. It handles both nullable and non-null (!) types, and list types ([Type]).
How are GraphQL scalars mapped?
String and ID become string, Int and Float become number, Boolean becomes boolean. Custom scalars default to unknown.
Does it handle enums?
Yes. GraphQL enums are converted to TypeScript enum declarations with string values matching the GraphQL enum values.
How is nullability handled?
Non-null types (!) become required TypeScript fields. Nullable types (without !) become optional fields with the ? suffix.