Closed pronebird closed 6 years ago
Types can be imported similarly to a named export:
import React, { Component, type Node, type ElementProps, ... } from "react";
Just use always named exports
import * as React from 'react';
const { Component } = React;
Someday module.exports
will be removed from react and all you imports will be changed. It's much easier to do things right in the beginning.
Thanks for suggestions!
Documentation states that such entities as
React.Node
are not automatically made available with Javascript import ofReact
. And so documentation suggests to use the following:Which is great but then this doesn't work if I want to reimport the
React.Component
into the scope inline, for example:Is it possible to scope the flow type imports, for example React:
It would be great to either:
import type
to import the entire module into the alias, such as following the same JS practice:= or =
import type
thing.What do you think?