我有一个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;
}
我使用的是TypeScript 3.8的仅输入和输出功能。
import type PropsType from './PropsType';
import type { ImageSrc } from './PropsType';
但是eslint会抛出一个错误:
多次导入.“/PropsType”。eslint(导入/无重复项)
我期望eslint满足这个只输入类型的导入和导出规则。有没有一种方法可以满足这个eslint规则而不禁用它?
1条答案
按热度按时间70gysomp1#
使用
typescript-eslint
插件中的@typescript-eslint/no-duplicate-imports
规则:https://typescript-eslint.io/rules/no-duplicate-imports/