oliviertassinari/react-swipeable-views

Typo in overscanSlideBefore affecting TypeScript

Closed this issue · 1 comments

In the virtualize component, the overscanSlideBefore property has a typo... in the latest NPM package, it's mis-typed as Slied

    return (
      <VirtualizeSwipeableViews 
      index={this.getIndex()}
      onChangeIndex={(newIndex:any) => this.props.onRelativeIndexChanged(newIndex - start)}
      slideRenderer={this.slideRenderer}
      overscanSlideAfter={1}
      overscanSliedBefore={1}

It seems to only affect typescript... the types seem to think the property is misspelled, but using the misspelled version doesn't work (throws a console error and property doesn't get applied).

Workaround is to use any like follows...

    var additionalProps:any = {
      overscanSlideBefore: 1
    };

    return (
      <VirtualizeSwipeableViews 
      index={this.getIndex()}
      onChangeIndex={(newIndex:any) => this.props.onRelativeIndexChanged(newIndex - start)}
      slideRenderer={this.slideRenderer}
      overscanSlideAfter={1}
      {...additionalProps}
      onWheel={this.onWheel}
      onScroll={this.onScroll}
      className={this.props.classes.swipeableViews}/>
    );

The type definitions aren't in this library, they're in DefinitelyTyped, where this issue was already fixed.