jsx-eslint/eslint-plugin-react

prop-types: children and React.VFC

Open

#2,913 opened on Feb 1, 2021

 (14 comments) (3 reactions) (0 assignees)JavaScript (2,731 forks)batch import
help wantedtypescript

Repository metrics

Stars
 (9,293 stars)
PR merge metrics
 (PR metrics pending)

Description

There is now a way to properly communicate the absence of the children prop at the TypeScript level: React.VFC (vs React.FC). React.VFC aka React.VoidFunctionComponent does not allow children prop, the prop-types rule should derive the presence/absence of children from the underlying TypeScript types (when used with TypeScript).

Related: #7.

Contributor guide