As mentioned in React documentation, a stateless component can return false for empty content. Currently StatelessComponent is defined as:
interface StatelessComponent<P = {}> {
(props: P & { children?: ReactNode }, context?: any): ReactElement<any> | null;
whereas Component has
class Component<P, S> {
constructor(props?: P, context?: any);
// ...snip...
render(): JSX.Element | null | false;
Shouldn't these types be the same (including eliminating the ReactElement vs JSX.Element difference)? And to avoid future such issues (#14064, this one) it should probably be a named type, e.g. RenderResult.
A search for | null also comes up with ComponentSpec.render which probably should also have the same result type.
@types/xxxxpackage and had problems.Definitions by:inindex.d.ts) so they can respond.As mentioned in React documentation, a stateless component can return
falsefor empty content. Currently StatelessComponent is defined as:whereas Component has
Shouldn't these types be the same (including eliminating the ReactElement vs JSX.Element difference)? And to avoid future such issues (#14064, this one) it should probably be a named type, e.g. RenderResult.
A search for
| nullalso comes up withComponentSpec.renderwhich probably should also have the same result type.