The problem: When using this package to define an object shape for something like a view containing a form, you essentially need to define your validation twice, once for your props and once for your form validation. After that you need the same definition on your server, somehow, most likely. Using multiple type definition mechanisms and defining what is essentially the same structure multiple times is a shame and seems like a real waste.
The proposed solution: This package is already a great basis for generic validation. You could simply expose a method of some sort that would allow passing an object and running the prop-types validation on it. At that point it could even be used on the server.
As a bonus: Add a means of supplying custom errors/error messages.
I am aware that you are not supposed to call the prop types functions so that "it is safe to strip their implementations to optimize the bundle size". However, it would be a huge benefit to provide a means of keeping specific declarations of them intact.
Overall, you have such a nice package for defining these types of semantics here, I'd just like to see it reach it's full potential. :)
The problem: When using this package to define an object shape for something like a view containing a form, you essentially need to define your validation twice, once for your props and once for your form validation. After that you need the same definition on your server, somehow, most likely. Using multiple type definition mechanisms and defining what is essentially the same structure multiple times is a shame and seems like a real waste.
The proposed solution: This package is already a great basis for generic validation. You could simply expose a method of some sort that would allow passing an object and running the prop-types validation on it. At that point it could even be used on the server.
As a bonus: Add a means of supplying custom errors/error messages.
I am aware that you are not supposed to call the prop types functions so that "it is safe to strip their implementations to optimize the bundle size". However, it would be a huge benefit to provide a means of keeping specific declarations of them intact.
Overall, you have such a nice package for defining these types of semantics here, I'd just like to see it reach it's full potential. :)