不能将导出用作类型,因为exports是一个值 [英] Cannot use exports as a type because exports is a value

查看:240
本文介绍了不能将导出用作类型,因为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'

这篇关于不能将导出用作类型,因为exports是一个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆