我有一个像这样的 PropsTypes.ts
文件:
export interface ImageSrc { url: string; originUrl: string }
export default interface PropsType {
images: Array<ImageSrc> | Array<string>;
visible: boolean;
activeIndex?: number;
showPagination?: boolean;
maxScale?: number;
minScale?: number;
onChange?: Function;
onClose?: Function;
}
我正在使用type-only-imports-and-export TypeScript 3.8 的功能。
import type PropsType from './PropsType';
import type { ImageSrc } from './PropsType';
但是 eslint 会抛出错误:
'./PropsType' imported multiple times. eslint(import/no-duplicates)
我预计 eslint 应该满足仅类型导入和导出的规则。 有没有办法在不禁用它的情况下满足这个 eslint 规则?
最佳答案
使用 typescript-eslint
插件中的 @typescript-eslint/no-duplicate-imports
规则:https://typescript-eslint.io/rules/no-duplicate-imports/
关于typescript - 仅类型导入与无重复导入 eslint 规则冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66366815/