export type PublicOrPrivateProps = {
publicOrPrivate: PublicOrPrivateT
};
export default ({ publicOrPrivate }: PublicOrPrivateProps) => <Box>{publicOrPrivate}</Box>;
我正在尝试像这样导入:
import type PublicOrPrivate, { PublicOrPrivateProps } from 'components/newrfq/reviewRFQ/PublicOrPrivate';
但它失败并出现以下错误:
type referenced from value position
最佳答案
您可以在名称列表中写入type
,例如
import PublicOrPrivate, { type PublicOrPrivateProps } from 'components/newrfq/reviewRFQ/PublicOrPrivate';
此语法是在 Flow 0.38.0 中添加的。
关于javascript - 如何同时导入组件和 props 类型别名?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44748658/