Jacse / react-native-app-intro-slider

Simple and configurable app introduction slider for react native
MIT License
1.66k stars 330 forks source link

Getting TS warning: "No overload matches this call" #189

Closed nexorianus closed 4 years ago

nexorianus commented 4 years ago

Using "react-native-app-intro-slider": "^4.0.2", and

<AppIntroSlider
  renderItem={this._renderItem}
  data={slides}
  //ref={(ref) => this.slider = ref} } //same with all following commented in
  //onDone={this._onDone}
  //showNextButton={false}
  //showDoneButton={false}
  //dotStyle={styles.dot}
  //activeDotStyle={styles.activeDot}
/>

im getting the following Warning from TS:

(alias) class AppIntroSlider<ItemT>
import AppIntroSlider

No overload matches this call.
  Overload 1 of 2, '(props: Readonly<Props<unknown>>): AppIntroSlider<unknown>', gave the following error.
    Type '{ ref: (ref: AppIntroSlider<unknown>) => AppIntroSlider<unknown>; renderItem: ({ item, index }: { item: any; index: any; }) => Element; data: ISlide[]; onDone: () => void; showNextButton: false; showDoneButton: false; dotStyle: AnyStyle; activeDotStyle: AnyStyle; }' is missing the following properties from type 'Pick<Readonly<Props<unknown>> & Readonly<{ children?: ReactNode; }>, "testID" | "onDone" | "data" | "style" | "children" | "renderItem" | "renderSkipButton" | ... 139 more ... | "nestedScrollEnabled">': showPrevButton, showSkipButton
Overload 2 of 2, '(props: Props<unknown>, context?: any): AppIntroSlider<unknown>', gave the following error.
    Type '{ ref: (ref: AppIntroSlider<unknown>) => AppIntroSlider<unknown>; renderItem: ({ item, index }: { item: any; index: any; }) => Element; data: ISlide[]; onDone: () => void; showNextButton: false; showDoneButton: false; dotStyle: AnyStyle; activeDotStyle: AnyStyle; }' is missing the following properties from type 'Pick<Readonly<Props<unknown>> & Readonly<{ children?: ReactNode; }>, "testID" | "onDone" | "data" | "style" | "children" | "renderItem" | "renderSkipButton" | ... 139 more ... | "nestedScrollEnabled">': showPrevButton, showSkipButton
ts(2769)

I'm guessing, that the types passed in index.d.ts are not reflecting the optional values correctly, or the docu is out of date.

The Component renders without problems. The Error is only in Editor.

System: macOS, Editor: Visual Studio Code

evanlarkin10 commented 4 years ago

Im having this issue as well

KrishyV commented 4 years ago

Likewise over here. Renders just fine but tsc throws this error.

Jacse commented 4 years ago

Please try version 4.0.4 and let me know if it works!

Maker-Mark commented 3 years ago

@Jacse Still seeing this issue

yehyaumar commented 3 years ago

Please reopen this issue, still not fixed. Still facing this issue in version 4.0.4

tarun-sharma-201 commented 7 months ago

Just write // @ts-ignore on the above line to ignore the ts error.