Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update types in index.d.ts #195

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update types in index.d.ts #195

wants to merge 1 commit into from

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