Convert a JSON Schema document (draft 4 through 2020-12, plus OpenAPI 3.x schemas) into TypeScript interface and type declarations. Handles $ref, local definitions / $defs, oneOf / anyOf / allOf, tuples (prefixItems), enum, const, additionalProperties, and patternProperties. Everything runs locally; your schema never leaves the page.
| JSON Schema | TypeScript |
|---|---|
| "type": "string" | string |
| "type": "number" / "integer" | number |
| "type": "boolean" | boolean |
| "type": "null" | null |
| "type": ["string","null"] | string | null |
| "enum": ["a","b"] | "a" | "b" |
| "const": 42 | 42 |
| "type":"array","items":T | T[] |
| "prefixItems":[A,B], "items":false | [A, B] |
| "oneOf"/"anyOf":[A,B] | A | B |
| "allOf":[A,B] | A & B |
| "additionalProperties": T | [k: string]: T |
| "$ref": "#/$defs/X" | X |
| "required": [...] | non-optional ? |
Local refs of the form #/definitions/Foo, #/$defs/Foo, and OpenAPI-style #/components/schemas/Foo become named TypeScript types. External (http://) refs are emitted as unknown with a JSDoc note — fetching them would defeat the no-network promise.