mifi / react-lottie-player

Fully declarative React Lottie player
MIT License
495 stars 52 forks source link

Match TS props to React PropTypes #72

Closed vgpena closed 2 years ago

vgpena commented 2 years ago

This PR marks some fields on the LottieProps type signature as Optional in order to match the React PropTypes.

In a TypeScript project, creating a LottiePlayer with only animationData will trigger this TypeScript error:

Type '{ animationData: Record<string, unknown>; play: boolean; loop: true; }' is missing the following properties from type 'Pick<any, "loop" | "renderer" | "rendererSettings" | "audioFactory">': renderer, rendererSettings, audioFactory

According to the React PropTypes, the "missing" fields are not required and the component functions without them.

mifi commented 2 years ago

thanks!