According to the official site, React components may return null to prevent any rendering. But due to a likely bug in the definition files, I get a type error when trying to use a component that possibly returns null. Here is the compiler error:
(54,3): error TS2345: Argument of type '(props: PaginationProps) => Element | null' is not assignable to parameter of type 'ComponentClass<PaginationProps & {}> | StatelessComponent<PaginationProps & {}>'.
Type '(props: PaginationProps) => Element | null' is not assignable to type 'StatelessComponent<PaginationProps & {}>'.
Type 'Element | null' is not assignable to type 'ReactElement<any>'.
Type 'null' is not assignable to type 'ReactElement<any>'.
I think the fix is to make ReactElement nullable
xxxx/xxxx.d.tsfile in this repo and had problems.xxxx/xxxx.d.ts.According to the official site, React components may return
nullto prevent any rendering. But due to a likely bug in the definition files, I get a type error when trying to use a component that possibly returnsnull. Here is the compiler error:I think the fix is to make
ReactElementnullable