[Fix]:no-unused-prop-types
: typescript interface support literal type and only FunctionComponent should have propTypes validation
#2690
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pr is trying to fix #2686 and #2689 .
To fix #2686 :
I add both string and number Literal type support to interface.
And to fix #2689 :
I add a validation for FunctionComponent in propTypes.js function markAnnotatedFunctionArgumentsAsDeclared which name isJSXFunctionComponent.It can check whether function is return JSXElement or not.
AFAIK only function that return JSXElement need propTypes validation.
Thanks you so much for your code review!