`Visitor` callback `element` argument is typed incorrectly in TypeScript
TheSonOfThomp opened this issue · 0 comments
TheSonOfThomp commented
The Flow type definition of the element
argument is found in src/element.js
:
export type UserElement = {
type: ComponentType<DefaultProps> & ComponentStatics,
props: DefaultProps,
$$typeof: typeof REACT_ELEMENT_TYPE
}
In scripts/react-ssr-prepass.d.ts
this type is mapped to React.ElementType<any>
. However, the type defined above more accurately would be mapped to React.ReactElement<any>
(see @types/react)