1

In the process of developing an app, in the fronted, i'm facing a weird problem with the onClick function, which is the following

Type '(e: SyntheticEvent<Element, Event>) => void' is not assignable to type 'CustomValueType | MotionValue<number> | MotionValue<string> | MotionValue<any> | ((event: MouseEvent<{}, MouseEvent>) => void)'.
  Type '(e: SyntheticEvent<Element, Event>) => void' is not assignable to type '(event: MouseEvent<{}, MouseEvent>) => void'.
    Types of parameters 'e' and 'event' are incompatible.
      Type 'MouseEvent<{}, MouseEvent>' is not assignable to type 'SyntheticEvent<Element, Event>'

And these are the onClick functions where this error appears

onClick={(e: SyntheticEvent) => {
                          setDeleteAddOptions(!deleteAddOptions),
                            e.stopPropagation();
}}


onClick={(e: SyntheticEvent) => e.stopPropagation()}

Maybe is a type definition problem? What can i do to solve it?

Thanks for your time !

1 Answer 1

1

As the error says. you are trying to assign a type of Synthetic event to a component that expects a MouseEvent. Just swap out SyntheticEvent for MouseEvent and you should be good.

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.