Search code examples
javascriptflowtype

Cannot use exports as a type because exports is a value


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.


Solution

  • The 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'