javascriptreactjsreact-animations

Issue with react-animation-components package


So in my app I am adding react-animation-components by typing

yarn add react-animation-components@3.0.0

Then I import the FadeTransform property

import { FadeTransform } from 'react-animation-components';

However, I am getting this message stating that the declaration of react-animation-components is not recognized.

Message

I type this

yarn add @types/react-animation-components

but still nothing.

Why is this happening?


Solution

  • You can safely ignore this warning. It's typescript's checker complaining it doesn't know about the existence of a module named "react-animation-components". You're using vscode, probably turn on some setting that enables typescript checking to in your project.

    You cannot solve it by yarn add @types/react-animation-components. I checked, there isn't such a types definition package, no one authors it.

    So you either ignore this warning (it's safe), or add your own types definition file to this module. You can do it by creating a index.d.ts file at the root of your project and add a one-liner declare module "react-animation-components". Then the typescript checker will leave you alone.