在库定义中导入(flow-typed /)在流程中不起作用(静态类型检查器)

时间:2017-07-23 04:41:24

标签: javascript flow-typed

在库定义文件中导入(flow-typed / lib.js)似乎并不合适。

flow-typed中的目录结构:

flow-typed
   | - lib.js
   | - some-types.js

什么不起作用:

// in flow-typed/lib.js
import type {SomeTypes} from './some-types'
// use SomeTypes
// SomeTypes doesn't type check and silently fails

什么有效:

// in flow-typed/lib.js
type SomeTypes = {} // literally copy paste from some-type
// use SomeTypes
// works now

1 个答案:

答案 0 :(得分:0)

您需要JSON.parse直接列在flow-typed的{​​{1}}下:

[libs]

More info here.