Closed navin-moorthy closed 4 years ago
Should we type check every props we get from outside the components?
For options,
I have checked if the given options are Array of Object,
I think it's the responsibility of those who use the component to give a valid opitons. Now the component doesn't break on invalid values
Yes, I agree with that. Just that ensure functions are covered for cases that don't break the component.
Sure, I am checking all the where the component can break because of the types and fixing it.
As per my knowledge, I have fixed most of the cased except for the below props,
I will keep this issue and pull request open until I write the docs and write examples using the above props.
There are a few open source standards that we generally do, even at times when certain things are obvious to avoid breaking the code. These are done generally when typescript is not used.
Type check once, for every function by![image](https://user-images.githubusercontent.com/17434647/82045166-40084500-96cc-11ea-8882-d3bb2615cce7.png)
typeof x == 'function'
. Example, this shouldn't be an error. Instead a default filter function should load.Same way for all functions. I could see this being there in the source at few places. Should extend it everywhere.
Originally posted at issue