Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 无法从PropTypes获取func_Reactjs_Typescript_Material Ui_React Proptypes - Fatal编程技术网

Reactjs 无法从PropTypes获取func

Reactjs 无法从PropTypes获取func,reactjs,typescript,material-ui,react-proptypes,Reactjs,Typescript,Material Ui,React Proptypes,我无法理解为什么此导入或任何其他导入不起作用: import * as React from 'react'; import TextField from '@material-ui/core/TextField'; import * as PropTypes from 'prop-types'; import { withStyles } from '@material-ui/core/styles'; //import { PropTypes } fr

我无法理解为什么此导入或任何其他导入不起作用:

    import * as React from 'react';
    import TextField from '@material-ui/core/TextField';
    import * as PropTypes from 'prop-types';
    import { withStyles } from '@material-ui/core/styles';
    //import { PropTypes } from '@material-ui/core';

    interface IProps {
        value: string;
        onChange?: PropTypes.func;
    }

    const textField = (props: IProps) => {
        return (
            <div>HI</div>
        );
    };

    export default textField;
import*as React from'React';
从“@material ui/core/TextField”导入TextField;
从“道具类型”导入*作为道具类型;
从“@material ui/core/styles”导入{withStyles}”;
//从“@material ui/core”导入{PropTypes};
接口IProps{
值:字符串;
onChange?:PropTypes.func;
}
常量文本字段=(道具:IProps)=>{
返回(
你好
);
};
导出默认文本字段;
我收到的错误是:

ts app/node_modules/@types/prop types/index“”没有导出的成员“func”

我正在查看此文件,其中显然有这样一位成员:

export const func: Requireable<(...args: any[]) => any>;
export const func:Requireable any>;

也许有一天我会理解React以及这些依赖关系是如何工作的,谢谢!

PropTypes.func
是一个值(用于无状态函数组件的
PropTypes
属性或组件类的静态属性),但您正试图将其用作类型。相反,您可以手动编写基础类型:

onChange?: (...args: any[]) => any;
或者希望有一个更具体的适合您的应用程序

我正在查找错误消息