仅类型导入与 no-duplicate-imports eslint 规则冲突

时间:2021-02-25 10:32:24

标签: typescript eslint typescript-eslint

我有一个像这样的 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 的 type-only-imports-and-export 功能。

import type PropsType from './PropsType';
import type { ImageSrc } from './PropsType';

但是eslint会报错:

<块引用>

'./PropsType' 多次导入。 eslint(导入/无重复)

我希望 eslint 应该满足此规则,用于仅类型导入和导出。 有没有办法在不禁用它的情况下满足这个 eslint 规则?

0 个答案:

没有答案
相关问题