I get this error when running flow check
, but I'm not sure what it means.
Cannot use exports as a type because exports is a value. To get the type of a value use typeof.
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[];
}
Any ideas? I've googled for the error message but there's literally no results.
I get this error when running flow check
, but I'm not sure what it means.
Cannot use exports as a type because exports is a value. To get the type of a value use typeof.
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[];
}
Any ideas? I've googled for the error message but there's literally no results.
Share Improve this question edited Mar 27, 2018 at 9:06 Vadim Kotov 8,2848 gold badges50 silver badges63 bronze badges asked Mar 27, 2018 at 8:55 damddamd 6,95710 gold badges54 silver badges79 bronze badges 2 |2 Answers
Reset to default 20The problem was in a completely different file where I was importing IChunkSorter
incorrectly. I was using:
import type IChunkSorter from './IChunkSorter'
This fixed it:
import type { IChunkSorter } from './IChunkSorter'
I had the same issue when exporting an enum
as a type. I fixed the issue by exporting the enum as I would do with a regular constant: export MyEnum
.
Chunk
? If it is a type, you should import it withimport type ...
. Otherwise definetype ChunkType = typeof Chunk
and use itsort(chunks: ChunkType[]): ChunkType[];
– Aleksey L. Commented Mar 27, 2018 at 10:08Chunk
is a class and I still get the same error when I use what you suggested :/ – damd Commented Mar 27, 2018 at 11:37