Closed PavelZhuravlev closed 2 years ago
Hi! I'm not a master of TS, but if someone wants to fix it, PR is welcome.
until this is fixed you can hack around it with type inference like this:
import Lottie from "react-lottie-player";
// react-lottie-player doesn't export LottieProps
// https://stackoverflow.com/a/50924506/3793499
type TypeWithGeneric<T> = React.FC<T>;
type extractGeneric<Type> = Type extends TypeWithGeneric<infer X> ? X : any;
type LottiePropsIncludingNativeHTMLProps = extractGeneric<typeof Lottie>;
type LottieProps = Omit<
LottiePropsIncludingNativeHTMLProps,
| keyof React.ClassAttributes<HTMLDivElement>
| keyof React.HTMLAttributes<HTMLDivElement>
>;
export interface IAnimationProps extends LottieProps {
play?: boolean;
}
Hi, Thank you for the great component!
I have a question, Is there any way I can import
LottieProps
type to my project?