-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typescript: Lottie-web breaking change in 5.9.2 #70
Comments
Should this instead be fixed at lottie-web, and not here? Pardon my ignorance but I’m not an expert in ts |
All good! I'm a little confused as well. In the error that I have above, it says that in index.d.ts of this project, parameters declare module 'react-lottie-player' {
import type {
AnimationConfig,
AnimationDirection,
AnimationEventCallback,
AnimationSegment
} from 'lottie-web'
type LottieProps = React.DetailedHTMLProps<
React.HTMLAttributes<HTMLDivElement>,
HTMLDivElement
> &
Pick<AnimationConfig, 'loop' | 'renderer' | 'rendererSettings' | 'audioFactory'> & {
play?: boolean
goTo?: number
speed?: number
direction?: AnimationDirection
segments?: AnimationSegment | AnimationSegment[]
onComplete?: AnimationEventCallback
onLoopComplete?: AnimationEventCallback
onEnterFrame?: AnimationEventCallback
onSegmentStart?: AnimationEventCallback
} & ({ path?: string } | { animationData?: object })
const Lottie: React.FC<LottieProps>
export default Lottie To reproduce the error, you can try initialising the player in tsx where lottie-web is v5.9.2 import Lottie from 'react-lottie-player';
<Lottie
loop={false}
play={true}
animationData={link_to_file}
/> |
Also ran into this, so I created a wrapper specifying those now required attributes. Could be related to this which was causing a bunch of issues for us: facebook/react#24304 (comment) |
It seems this has to do with the fact that This is a workaround for now import Lottie from 'react-lottie-player';
<Lottie
loop={false}
play={true}
animationData={link_to_file}
audioFactory={undefined}
/> |
Was it removed? I still see it in index.d.ts file in the latest version of lottie-web github repo! For reference: The only change I see is that this line (line 79 on lottie-web v5.9.3) export type AnimationConfig<T extends 'svg' | 'canvas' | 'html' = 'svg'> = {} was refactored to export type RendererType = 'svg' | 'canvas' | 'html';
export type AnimationConfig<T extends RendererType> = {} And so this line also got changed (line 101 on lottie-web v5.9.3) export type AnimationConfigWithPath = AnimationConfig & {
path?: string;
}
export type AnimationConfigWithData = AnimationConfig & {
animationData?: any;
} to export type AnimationConfigWithPath<T extends RendererType> = AnimationConfig<T> & {
path?: string;
}
export type AnimationConfigWithData<T extends RendererType> = AnimationConfig<T> & {
animationData?: any;
} It's a small change and nothing got removed (unless im blind) so not sure why TS is complaining about |
@altruong This package depends on The original opener of the ticket is correct that the types have changed, but it looks like it's not in the way they described. The change in |
Lottie-web just updated their ts typing for loadAnimation parameter in their latest version v5.9.2
airbnb/lottie-web@eb6d9a6
Which breaks the current version of react-lottie-player
I've set my resolutions for lottie-web for v5.9.1 until its fixed, thanks!
The text was updated successfully, but these errors were encountered: