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

Issue with ArrayPredicates and .any checka #217

Open
vladfrangu opened this issue Jul 13, 2021 · 1 comment
Open

Issue with ArrayPredicates and .any checka #217

vladfrangu opened this issue Jul 13, 2021 · 1 comment

Comments

@vladfrangu
Copy link
Contributor

Hello, it's me again 👋

I've encountered an interesting issue with Predicates and .any checks.

Consider the following predicate:

const choicesPredicate = ow.array.ofType<[string, string | number]>(
	ow.array.exactShape([stringPredicate, ow.any(ow.string, integerPredicate)]),
);

This currently throws the following error, while running the code works and asserts it correctly:

image

Now, I don't know if this is not an intended use case for this, so bare with me, but if it is, then this seems like a small mistake somewhere. Looking at what the typings expect, ofType takes in BasePredicate, while exactShape takes Predicate. Any reason for that, is that an oversight?

Thanks!

@sindresorhus
Copy link
Owner

Probably just an oversight. See: b3c5fbd

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

No branches or pull requests

2 participants