FormidableLabs / react-ssr-prepass

A custom partial React SSR renderer for prefetching and suspense
MIT License
592 stars 26 forks source link

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

Open TheSonOfThomp opened 1 year ago

TheSonOfThomp commented 1 year ago

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)