Processed in your browser. Your data never leaves your device.
GraphQL to TypeScript Converter
Convert GraphQL SDL schemas to TypeScript interfaces, types, enums, and operations. Paste your schema and get typed code instantly.
// ── Scalars ──
export type DateTime = string;
// ── Enums ──
export enum UserRole {
ADMIN = "ADMIN",
EDITOR = "EDITOR",
AUTHOR = "AUTHOR",
READER = "READER",
}
// ── Types ──
/** A blog post */
export interface Post {
id: string;
title: string;
content: string;
slug: string;
published: boolean;
createdAt: string;
updatedAt?: string;
author: User;
tags: Tag[];
comments: Comment[];
}
export interface User {
id: string;
name: string;
email: string;
avatar?: string;
bio?: string;
posts: Post[];
role: UserRole;
}
export interface Comment {
id: string;
body: string;
author: User;
post: Post;
createdAt: string;
}
export interface Tag {
id: string;
name: string;
slug: string;
posts: Post[];
}
// ── Input Types ──
export interface CreatePostInput {
title: string;
content: string;
slug?: string;
published?: boolean;
tagIds?: string[];
}
export interface UpdatePostInput {
title?: string;
content?: string;
slug?: string;
published?: boolean;
tagIds?: string[];
}
// ── Operations ──
export interface Query {
/** Args: (limit: number, offset: number, published: boolean) */
posts: Post[];
/** Args: (id: string) */
post?: Post;
users: User[];
/** Args: (id: string) */
user?: User;
tags: Tag[];
}
export interface PostsArgs {
limit?: number;
offset?: number;
published?: boolean;
}
export interface PostArgs {
id: string;
}
export interface UserArgs {
id: string;
}
export interface Mutation {
/** Args: (input: CreatePostInput) */
createPost: Post;
/** Args: (id: string, input: UpdatePostInput) */
updatePost?: Post;
/** Args: (id: string) */
deletePost: boolean;
/** Args: (name: string, email: string, password: string) */
register: User;
}
export interface CreatePostArgs {
input: CreatePostInput;
}
export interface UpdatePostArgs {
id: string;
input: UpdatePostInput;
}
export interface DeletePostArgs {
id: string;
}
export interface RegisterArgs {
name: string;
email: string;
password: string;
}
4
Types
2
Inputs
1
Enums
0
Unions
0
Interfaces
1
Scalars
2
Operations
45
Fields
Press Ctrl+Enter to copy
Default Scalar Mappings
String → string
Int → number
Float → number
Boolean → boolean
ID → string
DateTime → string
Date → string
Time → string
JSON → Record<string, unknown>
JSONObject → Record<string, unknown>
Upload → File
BigInt → bigint
Related Convert Tools
0x
Number Base Converter
Convert numbers between binary, octal, decimal, and hex
CSV
CSV ↔ JSON Converter
Convert between CSV and JSON formats with custom delimiters
%20
URL Encoder & Decoder
Encode and decode URLs with encodeURIComponent and encodeURI
YML
JSON ↔ YAML Converter
Convert between JSON and YAML for Kubernetes, Docker, and CI/CD configs