From 2c52107f6ff92d65c10ce7c32a014155b32fbd17 Mon Sep 17 00:00:00 2001 From: Aakansha Doshi Date: Mon, 29 May 2023 18:30:30 +0530 Subject: [PATCH] remove ts ignore --- src/data/transform.ts | 9 ++++++--- src/data/types.ts | 7 ++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/data/transform.ts b/src/data/transform.ts index 8f59e20393..5502be7bed 100644 --- a/src/data/transform.ts +++ b/src/data/transform.ts @@ -49,7 +49,7 @@ const DEFAULT_LINEAR_ELEMENT_PROPS = { const DEFAULT_DIMENSION = 100; const bindTextToContainer = ( - containerProps: ValidContainer | ValidLinearElement, + containerProps: ValidContainer | ({ type: "arrow" } & ValidLinearElement), textProps: { text: string } & MarkOptional, ) => { let container; @@ -67,7 +67,6 @@ const bindTextToContainer = ( ...containerProps, }); } else { - //@ts-ignore container = newElement({ ...containerProps, }); @@ -283,7 +282,11 @@ export const convertToExcalidrawElements = ( elementWithid?.label?.text ) { let [container, text] = bindTextToContainer( - elementWithid, + elementWithid as + | ValidContainer + | ({ + type: "arrow"; + } & ValidLinearElement), elementWithid?.label, ); excalidrawElements.push(container); diff --git a/src/data/types.ts b/src/data/types.ts index 66e88f1041..09540b444d 100644 --- a/src/data/types.ts +++ b/src/data/types.ts @@ -44,7 +44,7 @@ export type LegacyAppState = { }; export type ValidLinearElement = { - type: ExcalidrawLinearElement["type"]; + type: "arrow" | "line"; x: number; y: number; label?: { @@ -113,6 +113,11 @@ export interface ImportedDataState { | ExcalidrawImageElement | ExcalidrawFreeDrawElement > + | ({ + type: Extract; + x: number; + y: number; + } & Partial) | ValidContainer | ValidLinearElement | ({