Skip to content

Issue with ArrayPredicates and .any checka #217

@vladfrangu

Description

@vladfrangu

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!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions