diff --git a/src/common/mask.ts b/src/common/mask.ts index 0d81d40..0bf2f92 100644 --- a/src/common/mask.ts +++ b/src/common/mask.ts @@ -1,5 +1,6 @@ import Base from '@src/common/base' import type { CommonConfig } from '@src/types/common-config' +import type { ICanvasImageSource } from '@src/types/utility-types' import { isString, loadImage, upperFirst } from '@src/utils' export type modeMethodNames = 'modeNormal' | 'modeGhost' diff --git a/src/common/shape.ts b/src/common/shape.ts index 01fe1ac..ab54845 100644 --- a/src/common/shape.ts +++ b/src/common/shape.ts @@ -1,7 +1,7 @@ import Base from '@src/common/base' import { doublePi, piBy180, regExp } from '@src/common/constants' import type { CommonConfig } from '@src/types/common-config' -import type { ValueOf } from '@src/types/utility-types' +import type { ICanvasImageSource, ValueOf } from '@src/types/utility-types' import { isArray, isString, loadImage } from '@src/utils' const validShapeTypes = ['circle', 'triangle', 'star', 'image'] as const diff --git a/src/types/global.d.ts b/src/types/global.d.ts index b1e564d..bbce3af 100644 --- a/src/types/global.d.ts +++ b/src/types/global.d.ts @@ -11,8 +11,3 @@ interface Window { mozRequestAnimationFrame?: AnimationFrameProvider['requestAnimationFrame'] WebKitMutationObserver?: MutationObserver } - -/** - * 排除没有 width 和 height 属性的元素 - */ -type ICanvasImageSource = Exclude diff --git a/src/types/utility-types.d.ts b/src/types/utility-types.d.ts index e14c57d..0da2282 100644 --- a/src/types/utility-types.d.ts +++ b/src/types/utility-types.d.ts @@ -2,3 +2,8 @@ * 获取 interface 或(类)数组的值 */ export type ValueOf = T extends ArrayLike ? T[number] : T[keyof T] + +/** + * 排除没有 width 和 height 属性的元素 + */ +export type ICanvasImageSource = Exclude diff --git a/src/types/wave.d.ts b/src/types/wave.d.ts index 2f1ab2b..a21c5f8 100644 --- a/src/types/wave.d.ts +++ b/src/types/wave.d.ts @@ -1,4 +1,5 @@ import type { CommonConfig } from './common-config' +import type { ICanvasImageSource } from './utility-types' export interface ComOptions { // 是否填充背景色,设置为 false 相关值无效