mirror of
https://github.com/idrawjs/idraw
synced 2026-05-24 10:08:34 +00:00
fix: type error
This commit is contained in:
parent
ba2a0f8798
commit
cc6f395a51
3 changed files with 17 additions and 7 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import {
|
||||
TypeData, TypePoint, TypeBoardSizeOptions,
|
||||
TypeHelperWrapperDotDirection, TypeConfig, TypeConfigStrict,
|
||||
TypeHelperWrapperDotDirection, TypeConfig, TypeConfigStrict, TypeElementBase,
|
||||
TypeElement, TypeElemDesc, TypeContext, TypeCoreOptions, TypeScreenContext,
|
||||
} from '@idraw/types';
|
||||
import Board from '@idraw/board';
|
||||
|
|
@ -194,7 +194,7 @@ class Core {
|
|||
this[_draw]();
|
||||
}
|
||||
|
||||
addElement(elem: TypeElement<keyof TypeElemDesc>): string | null {
|
||||
addElement(elem: TypeElementBase<keyof TypeElemDesc>): string | null {
|
||||
if (this[_onlyRender] === true) return null;
|
||||
const _elem = deepClone(elem);
|
||||
_elem.uuid = createUUID();
|
||||
|
|
|
|||
|
|
@ -1,10 +1,15 @@
|
|||
import { TypeElemDesc, TypeElement } from './element';
|
||||
import { TypeElemDesc, TypeElement, TypeElementBase } from './element';
|
||||
|
||||
type TypeData = {
|
||||
elements: TypeElement<keyof TypeElemDesc>[];
|
||||
type TypeDataBase = {
|
||||
elements: TypeElementBase<keyof TypeElemDesc>[];
|
||||
bgColor?: string;
|
||||
}
|
||||
|
||||
type TypeData = TypeDataBase & {
|
||||
elements: TypeElement<keyof TypeElemDesc>[];
|
||||
}
|
||||
|
||||
export {
|
||||
TypeData
|
||||
TypeData,
|
||||
TypeDataBase,
|
||||
};
|
||||
|
|
@ -8,7 +8,7 @@ type TypeElementAttrs = {
|
|||
angle: number;
|
||||
}
|
||||
|
||||
type TypeElement<T extends keyof TypeElemDesc> = TypeElementAttrs & {
|
||||
type TypeElementBase <T extends keyof TypeElemDesc> = TypeElementAttrs & {
|
||||
name?: string;
|
||||
uuid?: string;
|
||||
type: T;
|
||||
|
|
@ -16,6 +16,10 @@ type TypeElement<T extends keyof TypeElemDesc> = TypeElementAttrs & {
|
|||
desc: TypeElemDesc[T];
|
||||
}
|
||||
|
||||
type TypeElement<T extends keyof TypeElemDesc> = TypeElementBase<T> & {
|
||||
uuid: string;
|
||||
}
|
||||
|
||||
type TypeElemBoxDesc = {
|
||||
borderRadius?: number;
|
||||
borderWidth?: number;
|
||||
|
|
@ -74,4 +78,5 @@ export {
|
|||
TypeElemDescSVG,
|
||||
TypeElemDesc,
|
||||
TypeElement,
|
||||
TypeElementBase,
|
||||
};
|
||||
Loading…
Reference in a new issue