reactjs - 打字稿错误:找不到模块“react-dnd”的声明文件
问题描述
我目前在导入时收到此错误react-dnd
:
Could not find a declaration file for module 'react-dnd'. 'node_modules/react-dnd/lib/index.js' implicitly has an 'any' type.
Try `npm install @types/react-dnd` if it exists or add a new declaration (.d.ts) file containing `declare module 'react-dnd';
不react-dnd
提供类型定义?我需要做些什么才能访问这些类型吗?
我在严格模式下使用打字稿。我的应用是用 create-react-app 搭建的。
解决方案
react-dnd
确实带有类型定义,正如您在unpkg中看到的那样。您不需要做任何事情来访问这些类型。也许您使用的是旧版本的 react-dnd,它没有包含类型?
推荐阅读
- android - MapboxGeocoding 返回无效的经纬度(Android)
- java - 从 MySQL 存储/检索数千个数据数据的最佳选择不要快速高效地阻塞主线程
- excel - 如何使用 Power Query 编辑器在 Office Excel 中正确显示数据?
- python - 我正在尝试在 python 中创建一个虚拟环境,但出现错误“没有这样的文件或目录”
- php - 计算别名列的百分比
- c# - HttpPost 一个文件从 Node js 到 .net Core C#
- c++ - 两个项目之间的编码变化
- python - 将 numpy.ndarray 输出为 csr 文件
- javascript - 邮递员写信到控制台但想要 CSV?
- c++ - 如何在 std::set 中获得严格低于上限的值?