Closed haldunanil closed 6 years ago
There's no way to verify that with JavaScript without actually calling the function, which doesn't happen at prop verification time. The function itself needs to verify its arguments, at runtime - the best a propType could do is assert that the function's .length
is 1.
Another alternative is with adding a type system like Flow or TypeScript on top of JS.
Got it, that makes sense. Thanks!
Hi!
I'm looking to create a propType for a function that specifically must receive as its only argument an array containing File objects. Is there a way to do this natively or do I have to make a custom propType?
Thanks!