flowtype - "Ineligible value used in/as type annotation"流错误

标签 flowtype

我有一个 JS 文件:

// @flow
import type SomeType from './types';

export class MyClass extends React.Component {
  props: {
    someProp: Array<SomeType>
  };
}

在 types.js 中:

// @flow
export type SomeType = {
  someKey: number
}

正在运行flow Array<SomeType> 上出现以下错误:

exports. Ineligible value used in/as type annotation (did you forget 'typeof'?)

最佳答案

这就是我,一个 ES6 菜鸟。解决方法在于类型的导入方式。应该是:

import type {SomeType} from './types';

关于flowtype - "Ineligible value used in/as type annotation"流错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43153027/

相关文章:

javascript - 在流程 : test whether variables got set 中编写规范

javascript - 如何在流程中设置动态 react 类变量

javascript - Flow 适用于解构函数参数但不适用于非解构函数参数的场景

javascript - 流 JavaScript "Missing type annotation for T"和 "Missing type annotation for S"

javascript - 如何让 Flow 在 React 应用程序中验证 Web API?

javascript - 几个小的reduce vs 一个大的forEach?

javascript - 'A' 属性 (Array<prop>) 的可能值对值 'B' ([prop : string]: any)

javascript - Flow - 在类的静态中找不到属性

inheritance - 流 : types inheritance

javascript - flowjs 0.54.0 中的新 "Missing annotation"错误