每当我尝试像下面这样导入 DayPickerInput 时:
import DayPickerInput from 'react-day-picker/DayPickerInput';
我收到 ts 警告:“找不到模块 'react-day-picker/DayPickerInput 的声明文件。”
查看模块文件夹,看起来只有 DayPicker 定义了类型。
当我尝试使用 require 方法时,如下所示:
var DayPickerInput = require('react-day-picker').DayPickerInput;
我的项目构建良好,但是当需要显示组件时,我在控制台中收到 2 个运行时错误:
Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in.
Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in.
DayPickerInput 现在对我来说无法使用。