Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion types/react/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ declare namespace React {
type FC<P = {}> = FunctionComponent<P>;

interface FunctionComponent<P = {}> {
(props: PropsWithChildren<P>, context?: any): ReactElement | null;
(props: PropsWithChildren<P>, context?: any): ReactElement<any, any> | null;
propTypes?: WeakValidationMap<P>;
contextTypes?: ValidationMap<any>;
defaultProps?: Partial<P>;
Expand Down
4 changes: 4 additions & 0 deletions types/react/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ const LegacyStatelessComponent3: React.SFC<SCProps> =
// allows null as props
const FunctionComponent4: React.FunctionComponent = props => null;

// undesired: Rejects `false` because of https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18051
// leaving here to document limitation and inspect error message
const FunctionComponent5: React.FunctionComponent = () => false; // $ExpectError

// React.createFactory
const factory: React.CFactory<Props, ModernComponent> =
React.createFactory(ModernComponent);
Expand Down