From 8b3ab077a989e8702e28022d7339e8baf3fa9919 Mon Sep 17 00:00:00 2001 From: Arman Taherian Date: Thu, 18 Jul 2024 14:39:08 +0330 Subject: [PATCH 1/2] Fix TypeScript errors --- src/api/index.ts | 1 + src/util/console-color.ts | 2 +- src/wizard/wizard-dialog.ts | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/api/index.ts b/src/api/index.ts index c93ed57c..afae3fa6 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -23,6 +23,7 @@ const fetchApiBase = async ( if (!options.headers) { options.headers = {}; } + // @ts-ignore options.headers["X-CSRFToken"] = csrfCookie; } const resp = await fetch(path, options); diff --git a/src/util/console-color.ts b/src/util/console-color.ts index eb4a19e7..68d5ef5e 100644 --- a/src/util/console-color.ts +++ b/src/util/console-color.ts @@ -28,7 +28,7 @@ export class ColoredConsole { } addLine(line: string) { - const re = /(?:\033|\\033)(?:\[(.*?)[@-~]|\].*?(?:\007|\033\\))/g; + const re = /(?:\x1b|\\033)(?:\[(.*?)[@-~]|\].*?(?:\x07|\x07\\))/g; let i = 0; if (this.state.carriageReturn) { diff --git a/src/wizard/wizard-dialog.ts b/src/wizard/wizard-dialog.ts index 7d19765b..d645314e 100644 --- a/src/wizard/wizard-dialog.ts +++ b/src/wizard/wizard-dialog.ts @@ -326,14 +326,14 @@ export class ESPHomeWizardDialog extends LitElement { ${Object.keys(supportedPlatforms).map((key) => - supportedPlatforms[key].showInDeviceTypePicker + supportedPlatforms[key as SupportedPlatforms].showInDeviceTypePicker ? html` - ${supportedPlatforms[key].label} + ${supportedPlatforms[key as SupportedPlatforms].label} ${metaChevronRight} ` From fc3b3f24dc9928488a3c3a788aaead6a3d3ec27f Mon Sep 17 00:00:00 2001 From: Arman Taherian Date: Thu, 18 Jul 2024 14:51:25 +0330 Subject: [PATCH 2/2] Fix prettier issue --- src/wizard/wizard-dialog.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/wizard/wizard-dialog.ts b/src/wizard/wizard-dialog.ts index d645314e..507f0900 100644 --- a/src/wizard/wizard-dialog.ts +++ b/src/wizard/wizard-dialog.ts @@ -333,7 +333,10 @@ export class ESPHomeWizardDialog extends LitElement { .platform=${key} @click=${this._handlePickPlatformClick} > - ${supportedPlatforms[key as SupportedPlatforms].label} + ${supportedPlatforms[key as SupportedPlatforms] + .label} ${metaChevronRight} `