formkit / auto-animate

A zero-config, drop-in animation utility that adds smooth transitions to your web app. You can use it with React, Vue, or any other JavaScript application.

Home Page:https://auto-animate.formkit.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Typescript RefObject<T> not supported (React)

arimendelow opened this issue · comments

Because the hook just returns RefObject<Element>, you'll get the following error:

Screenshot 2023-05-20 at 2 13 51 PM

The only solution to this is to cast the ref to the required type, but it's quite silly as this should just accept a type parameter.

I believe this is already implemented:

function useAutoAnimate<T extends Element>(
  options?: Partial<AutoAnimateOptions> | AutoAnimationPlugin
): [RefCallback<T>, (enabled: boolean) => void]