grantila / suretype

Typesafe JSON (Schema) validator
502 stars 9 forks source link

Type-ensured validator should assert return type #17

Open dbartholomae opened 2 years ago

dbartholomae commented 2 years ago

Hi there!

Currently I have to manually do this:

export const assertPostMetaData: (
  data: unknown
) => asserts data is PostMetaData = compile(postMetaDataSchema, {
  ensure: true,
});

Would be nice if this type definition could be baked into suretype. I might be able to provide a PR :)