Javascript react和flow:在一行中导入节点类型和PureComponent

Javascript react和flow:在一行中导入节点类型和PureComponent,javascript,reactjs,react-native,ecmascript-6,flowtype,Javascript,Reactjs,React Native,Ecmascript 6,Flowtype,如何在一行中导入节点(flow使用的类型)和PureComponent,仅用于代码纯度 下面的行不起作用: import type { Node }, { PureComponent } from 'react'; // or import type { Node, PureComponent } from 'react'; 注意:我实际上使用这个 /* @flow */ import { PureComponent } from 'react'; import type { Node } f

如何在一行中导入
节点
(flow使用的类型)和
PureComponent
,仅用于代码纯度

下面的行不起作用:

import type { Node }, { PureComponent } from 'react';
// or
import type { Node, PureComponent } from 'react';
注意:我实际上使用这个

/* @flow */
import { PureComponent } from 'react';
import type { Node } from 'react';

提前感谢前面提到的文档中所写的

,对于使用命名类型导入,您需要在默认导入之外添加

同样,如果您
import React with:import React from'React'
您将能够访问
React.Component、React.createElement()、React.Children、
和其他JavaScript值。但是,您将无法访问
React.Node、React.ChildrenArray
或其他
流类型。
除了您的
默认导入之外,您还需要使用命名类型
导入,如:从'React'导入类型{Node}。
尝试此操作

import { type Node, PureComponent } from 'react';

工作正常且干净。

您确定
节点
反应
包的一部分吗?@ArnoldGandarillas我添加了实际工作的行。如果找到
节点
导入