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



我有一个JS文件:

// @flow
import type SomeType from './types';
export class MyClass extends React.Component {
  props: {
    someProp: Array<SomeType>
  };
}

在类型.js:

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

运行flowArray<SomeType>上给我以下错误:

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

这是我是一个 ES6 菜鸟。修复方式在于类型的导入方式。它应该是:

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

相关内容

最新更新