【发布时间】:2021-10-08 14:59:58
【问题描述】:
我有以下组件,我已将流类型标记添加到:
// @flow
import * as React from 'react';
type UnauthorisedProps = {|
message :string
|};
export function Unauthorised(props :UnauthorisedProps) :* {
return (
<div>
<div>{ props.message }</div>
</div>
);
}
但是在使用 this 的地方,flow 没有捕捉到这个错误:
import { Unauthorised } from '../unauthorised/Unauthorised';
// @flow
function SomethingElse(props) {
return (<Unauthorised mexssage={ props.message } );
}
我正在运行命令
yarn run flow check
它没有报告mexssage拼写错误的明显错误。
如果我将 UnauthorisedProps 定义更改为无效的内容,流程会报告错误,因此它正在查看代码。
【问题讨论】:
标签: javascript reactjs react-redux flowtype