Flow: Named import from module `react` This module has no named export called `Component`.

Created on 8 Apr 2017  路  8Comments  路  Source: facebook/flow

Is there a way to get around this warning?

import { Component } from 'react';

class Something extends Component {}

Named import from module react This module has no named export called Component.

Most helpful comment

The issue come from the next.js libdef from flow-typed. The libdef has a import type { Component } from 'react'; outside of a declare module block. The messes up the type checker in a major nearly untraceable way.

All 8 comments

After updating I'm getting this on the latest flow flow-bin as well

Hmm... I attempted downgrading Flow to see if this is truly a regression and it doesn't look to be. The issue emerged during a transition from Meteor to next.js.

Cannot reproduce: LINK

Issue disappears when all libdefs installed with flow-typed are removed. Looking for the troublesome libdef right now.

The issue come from the next.js libdef from flow-typed. The libdef has a import type { Component } from 'react'; outside of a declare module block. The messes up the type checker in a major nearly untraceable way.

Component is not a named export of react. It is a property on the default export... transpilers allow this to work for commonjs modules because of their interop, but it's technically incorrect.

My issue was a libdef like @keplersj suggested.

I too had this issue on a next.js project as @keplersj mentioned. I downgraded to flow-bin@^0.53.0 and the trouble is gone as done in the este project.

Was this page helpful?
0 / 5 - 0 ratings