Splidejs / splide-extension-auto-scroll

The Splide extension for continuously scrolling the slider.
https://splidejs.com/
MIT License
25 stars 41 forks source link

Property 'AutoScroll' of type 'AutoScrollComponent | undefined' is not assignable to string index type 'BaseComponent' #5

Closed davidpawar closed 2 years ago

davidpawar commented 2 years ago

Checks

Version

v0.4.2

Description

According to the documentation, I have added the AutoScroll extension.

import { Splide } from '@splidejs/splide';
import { AutoScroll } from '@splidejs/splide-extension-auto-scroll';

new Splide( '.splide' ).mount( { AutoScroll } );

After importing AutoScroll the build fails:

Property 'AutoScroll' of type 'AutoScrollComponent | undefined' is not assignable to 'string' index type 'BaseComponent'.

Is that happening only for me?

Reproduction Link

No response

Steps to Reproduce

  1. Follow the documentation to use AutoScroll https://splidejs.com/extensions/auto-scroll/
  2. Start the project :-)

Expected Behaviour

No build error.

davidpawar commented 2 years ago

Changing the interface inside AutoScroll.ts to:

    interface Components {
        AutoScroll: AutoScrollComponent;
    }

worked for me. (removed that AutoScroll is optional) Not sure if that's a suitable solution here.

NaotoshiFujita commented 2 years ago

I've checked it but haven't seen any error: https://codesandbox.io/s/5-jmwgm7?file=/src/index.ts