milosjanda / react-scroll-up

React component to add custom buttons for scrolling to top of page
MIT License
175 stars 28 forks source link

With React 18, type error as children are not listed as props #43

Closed Codigo-Fuentes closed 1 year ago

Codigo-Fuentes commented 2 years ago

Error is fixed my just adding children prop to interface ScrollToTopProps

Screen Shot 2022-04-11 at 9 48 37 AM Screen Shot 2022-04-11 at 9 49 04 AM
Codigo-Fuentes commented 2 years ago

Fix

Screen Shot 2022-04-11 at 9 55 37 AM
jeffdrumgod commented 2 years ago

Correct implement until fix component:

import type { ScrollToTopProps as ScrollToTopPropsCustom } from 'react-scroll-up';

declare module 'react-scroll-up' {
  export interface ScrollToTopProps extends ScrollToTopPropsCustom {
    children?: React.ReactNode;
  }
}
therealgilles commented 2 years ago

I'm getting this error with the above temp fix:

Type 'ScrollToTopProps' recursively references itself as a base type.
rgmvisser commented 1 year ago

@therealgilles It worked for me when adding https://github.com/milosjanda/react-scroll-up/issues/43#issuecomment-1250182332 into a separate .d.ts file. Hope that helps!

milosjanda commented 1 year ago

Please send the pull request, because I can't simulate it and everything works for me as is.

rgmvisser commented 1 year ago

@milosjanda https://github.com/milosjanda/react-scroll-up/pull/45

milosjanda commented 1 year ago

Sorry i missed it. It`s merged and new version has been released. Could you please confirm that everything work fine?

rgmvisser commented 1 year ago

Confirmed, thanks!

milosjanda commented 1 year ago

Thank you.