0

I have an interface where i define the structure of a callback like so:

interface SliderOptions {
    onCreateSlide?: (slide: Slide) => void;
    onSlideTransition?: (slide: Slide, offset: number, onTransitionComplete: () => void); // generates typescript compiler error. 
    // more options etc
}

but i get the follow error, see image below:

enter image description here

Why is this happening i dont get it, since the line right above it doesnt generate this error and does about the same thing imo.

3
  • Try onSlideTransition?: (slide: Slide, offset: number, onTransitionComplete: () => void)=> void; Commented Apr 13, 2021 at 20:49
  • yeah that fixed, no clue how i managed to miss something that obvious... Post it as an answer if you want, i will accept it Commented Apr 13, 2021 at 20:51
  • Happens to all of us :) Commented Apr 13, 2021 at 20:52

1 Answer 1

1

You have two functions returning void onSlideTransition and onTransitionComplete, so it should be onSlideTransition?: (slide: Slide, offset: number, onTransitionComplete: () => void)=> void;

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.