javascript - Flow 将导入的类型视为任何类型
问题描述
我有一个类型 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 将类型视为任何类型?
解决方案
您是否尝试过使用export type
而不是export interface
?
推荐阅读
- arrays - 用 C 语言反转句子,单词之间只有一个空格字符
- python - Pyyaml 条件语句
- encryption - 0.9.8h 和 1.1.1k 之间的 Openssl 兼容性问题
- python - Python框架pypi包安装问题
- node.js - 无法访问嵌套集合 Firestore
- java - 如何使用 Derby 在 Spring 中修复 fileNotFound 错误
- c - PIC18f4550 XC8编译器:使能中断服务程序功能时液晶屏停止工作
- cdn - 使用 Amp Cdn url
- electron - Electron 使用 LoadURL 防止打开新窗口并将其保留在当前窗口中
- python - 从字符串应用比较运算符