小编Mic*_*iti的帖子

我可以一次导入所有流类型吗?

假设我有这个:

import type { Collection } from './x.types.js';
import type { Collection } from './y.types.js';
Run Code Online (Sandbox Code Playgroud)

我想像这样导入两者:

import type * as XTypes from './x.types.js';
import type * as YTypes from './y.types.js';
Run Code Online (Sandbox Code Playgroud)

因为在我的代码中我将有一个名称空间,我可以轻松地识别它们来自哪里,并且我不会有任何声明冲突。

const something = (collection: Xtypes.collection) => {}
const something2 = (collection: Ytypes.collection) => {}
Run Code Online (Sandbox Code Playgroud)

typechecking flowtype

5
推荐指数
1
解决办法
856
查看次数

标签 统计

flowtype ×1

typechecking ×1