FormidableLabs / FormidableLabs/react-ssr-prepass

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

Open
#86 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
603
Forks
26
PR merge metrics
No merged PRs in 30d

Description

The Flow type definition of the `element` argument is found in `src/element.js`:
```js
export type UserElement = {
type: ComponentType & ComponentStatics,
props: DefaultProps,
$$typeof: typeof REACT_ELEMENT_TYPE
}
```

In `scripts/react-ssr-prepass.d.ts` this type is mapped to `React.ElementType`. However, the type defined above more accurately would be mapped to `React.ReactElement` (see [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react/index.d.ts#L151-L155))

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.