为什么 redux-form typings 中的许多接口没有导出?

Why are many of the interfaces in the redux-form typings not exported?

我想为 redux-form 制作一些自定义输入字段。

所以我开始查看文档中的 Material UI example

const renderTextField = ({input, label, meta: { touched, error }, ...custom }) =>
    <TextField
        hintText={label}
        floatingLabelText={label}
        errorText={touched && error}
        {...input}
        {...custom}
    />

看起来很简单,所以我查看了 definitely typed type definitions for redux-form and found the interfaces defining what I wanted

interface WrappedFieldProps {
    input: WrappedFieldInputProps;
    meta: WrappedFieldMetaProps;
}

但它们没有出口?

那么,如果我无法访问该界面,我该如何将界面应用于 renderField 函数?

我是不是遗漏了一些明显的东西,或者采用了错误的方法?

我认为官方文档没有错,所以不导出是类型定义错误吗?

解决此问题的一种方法是让渲染函数采用 props:any,但这会使类型定义变得无用!

const renderTextField = (props:any) => {
    const {input, label, meta: { touched, error }, ...custom } = props;

    return (
        <TextField
            hintText={label}
            floatingLabelText={label}
            errorText={touched && error}
            {...input}
            {...custom}
        />
    );
}

所以我不仅不能在自己的代码中使用这些接口,而且在将函数传递给 <Field component={renderTextField} /> 时也不会使用它们。

我发现实际上可以导入接口,即使它们没有被导出!

我使用的是 import * as ReduxForm from "redux-form";,它以名称 ReduxForm.

导入了模块

查看 ReduxForm 上可用的内容只显示了模块的导出部分。

但是,如果我使用明确要求非导出接口的导入 import { WrappedFieldProps } from "redux-form"; 那么它就可以工作,我可以使用该接口!

这让我有点困惑,它违背了我对 import/export 和模块工作原理的理解。但我很高兴我有一个解决方案。

我现在需要继续阅读 Typescript 导入,以确定这是一个功能还是一个错误。 (我认为这是一个功能)。