【问题标题】:Issue with react-animation-components packagereact-animation-components 包的问题
【发布时间】:2019-11-11 09:04:09
【问题描述】:

所以在我的应用程序中,我通过键入添加 react-animation-components

yarn add react-animation-components@3.0.0

然后我导入 FadeTransform 属性

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

但是,我收到此消息,指出 react-animation-components 的声明无法识别。

我输入这个

yarn add @types/react-animation-components

但还是什么都没有。

为什么会这样?

【问题讨论】:

    标签: javascript reactjs react-animations


    【解决方案1】:

    您可以放心地忽略此警告。打字稿的检查器抱怨它不知道名为“react-animation-components”的模块的存在。您正在使用 vscode,可能在您的项目中启用了一些启用 typescript 检查的设置。

    yarn add @types/react-animation-components 无法解决。我查了一下,没有这样的类型定义包,没有人编写它。

    所以你要么忽略这个警告(它是安全的),要么将你自己的类型定义文件添加到这个模块。您可以通过在项目的根目录创建一个index.d.ts 文件并添加一个单行declare module "react-animation-components" 来实现。然后打字稿检查器会让你一个人呆着。

    【讨论】:

    • 谢谢您的回答先生。我认为 npm 包已被弃用。
    猜你喜欢
    • 2019-10-07
    • 2021-12-11
    • 1970-01-01
    • 2021-11-01
    • 1970-01-01
    • 2018-02-09
    • 2019-04-03
    • 2020-08-09
    相关资源
    最近更新 更多