Skip to content

Conversation

hpello
Copy link

@hpello hpello commented Feb 15, 2023

Description

The current types trigger an error:

node_modules/react-visibility-sensor/index.d.ts:34:38 - error TS2694: Namespace 'React' has no exported member 'StatelessComponent'.

34   const ReactVisibilitySensor: React.StatelessComponent<Props>;
                                        ~~~~~~~~~~~~~~~~~~

Indeed, React.StatelessComponent has been removed from the react types (see https://stackoverflow.com/questions/44375759/how-should-i-declare-a-stateless-functional-component-with-typescript-in-react)

This PR fixes this error.

React.StatelessComponent has been removed from the react types (see https://stackoverflow.com/questions/44375759/how-should-i-declare-a-stateless-functional-component-with-typescript-in-react)

The current types trigger an error:
```
node_modules/react-visibility-sensor/index.d.ts:34:38 - error TS2694: Namespace 'React' has no exported member 'StatelessComponent'.

34   const ReactVisibilitySensor: React.StatelessComponent<Props>;
                                        ~~~~~~~~~~~~~~~~~~
```
@hpello
Copy link
Author

hpello commented Feb 21, 2023

Hello @joshwnj! Could you take a look at this PR? 🙂
We need it to keep using react-visibility-sensor in our TS codebase.

@vlapo
Copy link

vlapo commented May 31, 2023

@joshwnj StatelessComponent was deprecated in react v17 and removed in v18. Could you please merge this change? https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react/v17/index.d.ts#L537

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants