From b49ccbf497557c3cba084ba496f62552a865f3a5 Mon Sep 17 00:00:00 2001 From: Mark Tolmacs Date: Thu, 20 Feb 2025 16:38:47 +0100 Subject: [PATCH] Remove circular dep --- packages/math/rectangle.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/math/rectangle.ts b/packages/math/rectangle.ts index 519c83a27c..df08c17172 100644 --- a/packages/math/rectangle.ts +++ b/packages/math/rectangle.ts @@ -1,4 +1,3 @@ -import { invariant } from "../excalidraw/utils"; import { line, linesIntersectAt } from "./line"; import { pointFrom } from "./point"; import { @@ -30,10 +29,13 @@ export function rectangleFromPair

( export function rectangleFromArray

( pointArray: P[], ): Rectangle

{ - invariant( - pointArray.length === 4, - "Point array contains more or less points to create a rectangle from", - ); + if (!import.meta.env.PROD) { + if (pointArray.length !== 4) { + throw new Error( + "Point array contains more or less points to create a rectangle from", + ); + } + } return pointArray as Rectangle

; }