Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code generation from TS type aliases #5

Open
garbles opened this issue Mar 20, 2018 · 0 comments
Open

Code generation from TS type aliases #5

garbles opened this issue Mar 20, 2018 · 0 comments

Comments

@garbles
Copy link
Owner

garbles commented Mar 20, 2018

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
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant