javascript - 生成的 .d.ts 文件未正确获取导入
问题描述
我的default.ts
档案
import { Type, Units } from './Duration.types';
const defaultDuration = {
type: Type.Dynamic,
range: {
count: 12,
unit: Units.Hours
}
};
export { defaultDuration }
Type
并且Units
是enum
并且被导出为export { Type, Units }
这是我使用它的组件。
Component.tsx
import { defaultDuration } from './defaults';
static defaultProps = {
allowToggle: true,
duration: defaultDuration
};
我做npm run build
了并得到了一个显示错误的生成Component.d.ts
文件。
static defaultProps: {
allowToggle: boolean;
duration: {
type: Type;
range: {
count: number;
unit: Units;
};
};
};
错误说它找不到Type
或Units
在.d.ts
文件中
当我尝试.d.ts
在其他地方导入此文件时,它会引发上述错误。
解决方案
推荐阅读
- javascript - Javascript for Vectors 中运算符重载的更符合人体工程学的替代方案?
- excel - Excel VBA 无法跟踪通过复制和粘贴更改的所有行
- java - DataInput 的 javadoc 中的“bits 6-0”或“bits 10-6”是什么意思?
- c++ - GL_DYNAMIC_DRAW 性能峰值
- docker - Docker 容器未通过 ec2 上的 IP 连接
- javascript - 在移动设备上停用 vanillaJsuParallax
- arrays - 想要使用 Esp32 wrover 模块发布 768 数组以发布到 MQTT
- airflow - 创建气流连接时出错:因填充错误而失败
- node.js - Nodejs 模块化 aws-sdk v3 的大小越来越大
- python - 有没有办法更好地表示下面的数据?