Skip to content

Commit

Permalink
🏷️ Fix TypeScript error
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alecgibson authored and luin committed Jun 15, 2023
1 parent d5290e1 commit afcee5d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -194,7 +194,7 @@ class Editor {
}
return formats;
});
return { ...lines, ...leaves };
return { ...lineFormats, ...leafFormats };
}

getHTML(index: number, length: number): string {
Expand Down

0 comments on commit afcee5d

Please sign in to comment.