From afcee5d24482d91d16c80eee56cd6a5810c3e322 Mon Sep 17 00:00:00 2001 From: Alec Gibson <12036746+alecgibson@users.noreply.github.com> Date: Thu, 15 Jun 2023 11:02:53 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=B7=EF=B8=8F=20Fix=20TypeScript=20erro?= =?UTF-8?q?r?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit At the moment we try to reassign `lines: Blot` and `leaves: Blot` to `lines: {}` and `leaves: {}`. This change just creates new variables, so that we don't have these compiler errors. --- core/editor.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/editor.ts b/core/editor.ts index 0cd2064fdc..cc2a38abfb 100644 --- a/core/editor.ts +++ b/core/editor.ts @@ -184,7 +184,7 @@ class Editor { // @ts-expect-error leaves = this.scroll.descendants(LeafBlot, index, length); } - [lines, leaves] = [lines, leaves].map(blots => { + const [lineFormats, leafFormats] = [lines, leaves].map(blots => { if (blots.length === 0) return {}; let formats = bubbleFormats(blots.shift()); while (Object.keys(formats).length > 0) { @@ -194,7 +194,7 @@ class Editor { } return formats; }); - return { ...lines, ...leaves }; + return { ...lineFormats, ...leafFormats }; } getHTML(index: number, length: number): string {