sindresorhus / ow

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

Are the predicates in this lib, Typescript predicates?? #175

Closed plastikfan closed 4 years ago

plastikfan commented 4 years ago

I have been reading the code and documentatin for what seems like ages now and I can't tell if the predicates defined are Typescript predicates. As far as I can see, it looks like they are not, but being relatively new to typescript I can't tell (the reason I say this is I can't find the use of the 'is' keyword in the return type of a function). IE can the use of ow predicate be used to narrow down types for the typescript type-checker? Please can you make this explicitly clear in the documentation, thanks. Looking forward to a reply, regards.

plastikfan commented 4 years ago

What I was looking for is actually https://github.com/sindresorhus/is. Nuff said. However, I still think it should be made clear in ow that it doesn't provide type guard functionality.

sindresorhus commented 4 years ago

@plastikfan That's intentionally not supported. I was waiting for type assertions, which are more fitting for Ow. I've made it clear in the readme now.