kitimat
kitimat copied to clipboard
Code generation from TS type aliases
TS exposes custom transformers through the public API, so it should be possible to create generates purely from a type alias. I've done something like before with babel as Flow.
import { fromType } from 'kitimat-type-to-gen';
const person = fromType<Person>();
// would expand to something like...
const kitimat = require('kitimat-jest');
const person = kitimat.object<Person>({
name: kitimat.string(),
age: kitimat.posInt(),
// ... etc
});