react-ssr-prepass icon indicating copy to clipboard operation
react-ssr-prepass copied to clipboard

`Visitor` callback `element` argument is typed incorrectly in TypeScript

Open TheSonOfThomp opened this issue 2 years ago • 0 comments

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)

TheSonOfThomp avatar Apr 21 '23 21:04 TheSonOfThomp