不能将导出用作类型,因为exports是一个值
问题描述:
运行流程检查
时出现此错误,但我不确定这是什么意思。
I get this error when running flow check
, but I'm not sure what it means.
不能将导出用作类型,因为exports是一个值。要获取值类型,请使用typeof。
Cannot use exports as a type because exports is a value. To get the type of a value use typeof.
错误位置为0:1(在@flow注释中)。这是代码:
The error location is 0:1 (at the @flow comment). Here's the code:
/* @flow */
import Chunk from '../models/Chunk'
export interface IChunkSorter {
sort(chunks: Chunk[]): Chunk[];
}
有什么想法吗?我已经用Google搜索了错误消息,但实际上没有结果。
Any ideas? I've googled for the error message but there's literally no results.
答
问题出现在一个完全不同的文件中我是导入 IChunkSorter
错误。我正在使用:
The problem was in a completely different file where I was importing IChunkSorter
incorrectly. I was using:
import type IChunkSorter from './IChunkSorter'
这解决了这个问题:
import type { IChunkSorter } from './IChunkSorter'