MakeTypes from JSON samples

MakeTypes generates TypeScript classes that parse and typecheck JSON objects at runtime, and let you statically type check code that interacts with JSON objects. All it requires is a set of JSON samples.

Want to run MakeTypes as part of a build process? npm i -g maketypes installs the command line tool maketypes.

maketypes on NPM »

Source Code on GitHub »

Input: JSON Examples

Enter a single JSON object or an array of JSON objects.

Output: TypeScript Interfaces

Use these if you want to statically type check interactions with JSON objects without runtime type checks.

Output: TypeScript Proxies

Use these if you want to statically type check interactions with JSON objects with runtime type checks.

Type-checked JSON.parse

Proxy classes generated with MakeTypes will parse your JSON and check that it matches the expected type at runtime.

Statically type check code that interacts with JSON objects

Proxy objects generated with MakeTypes are expressed as TypeScript classes, so you can statically type check that your code is appropriately accessing fields on the JSON object. Code against web services with confidence!

Generate TypeScript interfaces to describe JSON types

Don't want the overhead of runtime type checking, and trust that your samples are representative? Or perhaps you are reluctant to manually create TypeScript typings for your web service? MakeTypes can generate TypeScript interfaces, which describe the expected structure of the JSON object and facilitate static type checking.