【发布时间】:2018-11-01 04:02:10
【问题描述】:
我有一个类似这样的类型 def 文件:
// Type Definitions
export interface IPane {
key: string;
tab?: string;
closable?: boolean;
title?: string;
}
export interface ApolloGraphQLResult<T> {
data: T;
errors: Array<any>;
loading: boolean;
networkStatus: NetworkStatus;
stale: boolean;
}
但是,当我导入这些类型时,Flow 只是将其视为任何类型:
import type { IPane } from '../../types'; // [Flow] IPane: any
这是我的 flowconfig 设置。
[ignore]
.*/dist/.*
.*/node_modules/jsonlint/.*
.*/node_modules/rc-util/.*
[include]
[libs]
./src/global.js
flow-typed
[options]
esproposal.decorators=ignore
module.name_mapper='^.*\.css$' -> 'css-module-flow'
module.name_mapper='^.*\.scss$' -> 'css-module-flow'
module.name_mapper='^.*\.less$' -> 'css-module-flow'
module.name_mapper='^components\(.*\)$' -> '<PROJECT_ROOT>/src/components/\1'
module.name_mapper='^containers\(.*\)$' -> '<PROJECT_ROOT>/src/containers/\1'
module.system=haste
module.system.node.resolve_dirname=node_modules
[lints]
我的设置似乎没有问题。重启流程不会改变任何事情。
我错过了什么?为什么 Flow 将类型视为任何类型?
【问题讨论】:
标签: javascript flowtype static-analysis