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

Retrieve expected type ow validated #197

Closed
sundaycrafts opened this issue Dec 30, 2020 · 2 comments · Fixed by #221
Closed

Retrieve expected type ow validated #197

sundaycrafts opened this issue Dec 30, 2020 · 2 comments · Fixed by #221

Comments

@sundaycrafts
Copy link

sundaycrafts commented Dec 30, 2020

I'm sorry if it had already discussed but I thought it would be great if ow has a function to retrieve the type ow validated like a Superstruct's infer.

Is it already planned? Or maybe it is not this project's goal🤔

@sindresorhus
Copy link
Owner

I think that could be useful.

@sindresorhus sindresorhus changed the title retrieve expected type ow validated Retrieve expected type ow validated Jan 6, 2021
@jorisre
Copy link
Contributor

jorisre commented Aug 12, 2021

@sindresorhus Regarding the expected API. Does something like that is good for you?

import ow, { Infer } from 'ow';

const schema = ow.object.exactShape({
  name: ow.string
});

type Schema = Infer<typeof schema>;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants