diff --git a/ts/lib/shadow-dom.d.ts b/ts/lib/shadow-dom.d.ts new file mode 100644 index 000000000..45ba96990 --- /dev/null +++ b/ts/lib/shadow-dom.d.ts @@ -0,0 +1,7 @@ +export {}; + +declare global { + interface DocumentOrShadowRoot { + getSelection(): Selection | null; + } +} diff --git a/ts/reviewer/index.ts b/ts/reviewer/index.ts index 7381a865c..3b69aafa0 100644 --- a/ts/reviewer/index.ts +++ b/ts/reviewer/index.ts @@ -80,9 +80,14 @@ function setInnerHTML(element: Element, html: string): void { const renderError = (type: string) => - (error: Error): string => { + (error: unknown): string => { const errorMessage = String(error).substring(0, 2000); - const errorStack = String(error.stack).substring(0, 2000); + let errorStack: string; + if (error instanceof Error) { + errorStack = String(error.stack).substring(0, 2000); + } else { + errorStack = ""; + } return `