tell me the best way to assign flow type to an exported module?

If you’re trying to define the type interface of myObject to be Options on export for types-first. You’ll want to change your file to look like this,

// @flow
type Options = {
  active?: string,
  name?: string,

exports.myObject = ((process.env.NODE_ENV === 'dev' ? {
  active: 'some string',
  name: 'some string',
} : {}): Options);

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top