Skip to content

Commit cefafa2

Browse files
committed
remove assertion
1 parent a353922 commit cefafa2

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

src/main.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -200,18 +200,16 @@ function main(): void {
200200
for (const error of currentDictionary.errors) {
201201
const element = document.createElement("li");
202202
element.innerText = error.message;
203-
if (error instanceof PositionedError && error.position != null) {
204-
const { position, length } = error.position;
205-
element.addEventListener("click", () => {
206-
customDictionaryTextBox.focus();
207-
customDictionaryTextBox.setSelectionRange(
208-
position,
209-
position + length,
210-
);
211-
});
212-
} else {
213-
throw new Error("error without position");
214-
}
203+
const { position: { position, length } } = error as PositionedError & {
204+
position: { position: number; length: number };
205+
};
206+
element.addEventListener("click", () => {
207+
customDictionaryTextBox.focus();
208+
customDictionaryTextBox.setSelectionRange(
209+
position,
210+
position + length,
211+
);
212+
});
215213
customDictionaryErrorList.appendChild(element);
216214
}
217215
}

0 commit comments

Comments
 (0)