sindresorhus / ow

Function argument validation for humans
https://sindresorhus.com/ow/
MIT License
3.8k stars 105 forks source link

Wrong typings for `array.ofType` used with `any` predicate #171

Closed jeremyben closed 4 years ago

jeremyben commented 4 years ago

Hi, thank you for your very intuitive validation lib. Tested a lot of them and yours got the most approvals from my team. 👍

I ran into a typing issue, not a blocking one, since it works as expected during runtime, but the compiler is not happy with it :

ow(['a', 1], ow.array.ofType(ow.any(ow.string, ow.number)))

image

I just cast as any for the moment and everything's fine : ow(['a', 1], ow.array.ofType(ow.any(ow.string, ow.number) as any))