Skip to content
BEAD

JSON Schema → TypeScript

Emit TypeScript types from a JSON Schema — enum/oneOf/allOf/$ref/definitions all handled.

TypeScript
export type Profile = {
  name: string;
  age?: number;
};

export type User = {
  id: number;
  email: string;
  role?: "admin" | "user" | "guest";
  profile?: Profile;
  tags?: string[];
  createdAt?: string;
};

What we handle

  • type — string / number / integer / boolean / null / array / object
  • enum → literal unions
  • oneOf / anyOf → union types
  • allOf → intersection types
  • $ref within the same document (#/definitions/Foo or #/$defs/Foo)
  • required — fields not listed become optional

Not handled

External $refs, patternProperties, and complex validation keywords (format, min/max,pattern) don't affect TypeScript types so they're dropped silently.

You might also like

Used in these workflows