Typescript errror: Type '(props: { newHeight: number; }) => void' is not assignable to type '(event: AnimationEvent<HTMLDivElement>) => void
See original GitHub issueCode example
<AnimateHeight
duration={300}
height={childrenHeight}
onAnimationStart={(props: { newHeight: number }) =>
handleAnimationStart(props.newHeight)
}
>
Expected behavior
Typescript error Type '(props: { newHeight: number; }) => void' is not assignable to type '(event: AnimationEvent<HTMLDivElement>) => void
:
Possible Solution
Remove & HTMLAttributes<HTMLDivElement>
?
export type AnimateHeightProps = {
animateOpacity?: boolean;
animationStateClasses?: AnimationStateClasses;
applyInlineTransitions?: boolean;
children: ReactNode | ReactNode[];
className?: string;
contentClassName?: string;
delay?: number;
duration?: number;
easing?: "ease" | "linear" | "ease-in" | "ease-out" | "ease-in-out" | string;
height?: string | number;
onAnimationEnd?(props: { newHeight: number }): void;
onAnimationStart?(props: { newHeight: number }): void;
style?: CSSProperties;
} & HTMLAttributes<HTMLDivElement>
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:14 (14 by maintainers)
Top Results From Across the Web
Type 'void' is not assignable to type '((event: ChangeEvent ...
I assume you are not passing the event object into the handleChange method. This is how you should amend your onChange event handler:...
Read more >type 'void' is not assignable to type 'reactnode'. - You.com
You just need to add data property to Row component props. import React, { PureComponent } from "react" ...
Read more >Forms and Events - React TypeScript Cheatsheets
Event that occurs whenever a form or form element gets/loses focus, a form element value is changed or the form is submitted. InvalidEvent,...
Read more >Type 'void' is not assignable to type '((event - JavaScript
JavaScript : Type ' void ' is not assignable to type '(( event : MouseEventHTMLInputElement) = void ) | undefined' [ Gift :...
Read more >[Solved]-TypeScript error: Type 'void' is not assignable to type ...
[Solved]-TypeScript error: Type 'void' is not assignable to type 'SetStateAction<string>'-Reactjs. Search. score:0. //value type changes const ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ahah, thank you it works perfectly! 🔥
Dang! My bad again 🙈
Omit
it is! I’ll try to get the new version out asap.