1

I created a Gatsby JS website and I would like to use some simple animations for the text. The library 'react-animations' is the library I chose for the scope.

When installing it with

npm i --save react-animations

I get the following messages:

npm WARN eslint-config-react-app@4.0.1 requires a peer of eslint-plugin-flowtype@2.x but none is installed. You must install peer dependencies yourself.

npm WARN ts-pnp@1.1.4 requires a peer of typescript@* but none is installed. You must install peer dependencies yourself.

npm WARN tsutils@3.17.1 requires a peer of > typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.

By trying to use the library this way:

import styled, { keyframes } from 'styled-components'
import { slideInDown } from 'react-animations'

const slideInDownAnimation = keyframes`${slideInDown}`;

const slideDown = styled.div`
  animation: 2s ${slideInDownAnimation};
`
;

It doesn't work and I get the following message when the import is located:

Could not find a declaration file for module 'react-animations'. 'c:path/node_modules/react-animations/lib/index.js' implicitly has an 'any' type. Try npm install @types/react-animations if it exists or add a new declaration (.d.ts) file containing declare module 'react-animations';

I tried

npm install @types/react-animations

But it doesn't exist.

Any clue on how to solve? Is typescript needed?

Thanks a lot.

Giulia
  • 765
  • 2
  • 8
  • 33

0 Answers0