Skip to content

Typescript to schema #836

Answered by streamich
KieranFleckney asked this question in Q&A

You must be logged in to vote

You can use JsonNodeView and SchemaToJsonNode types to convert your schema to a TypeScript type:

const schema = s.obj({
  name: "test",
  age: 1,
});

type Person = JsonNodeView<SchemaToJsonNode<typeof schema>>;

Replies: 1 comment

You must be logged in to vote
0 replies
Answer selected by streamich
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants