From cb780817f3c54a1f7f46b51586190a258c9a643e Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 8 Mar 2021 07:46:40 +0100 Subject: [PATCH] Correctly type StyleElement --- src/components/BootswatchThemeSelect.vue | 7 ++++--- src/components/ftbot/BotControls.vue | 2 +- src/types/styleElement.ts | 7 +++++++ 3 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 src/types/styleElement.ts diff --git a/src/components/BootswatchThemeSelect.vue b/src/components/BootswatchThemeSelect.vue index 5aed3df8..4efab519 100644 --- a/src/components/BootswatchThemeSelect.vue +++ b/src/components/BootswatchThemeSelect.vue @@ -36,6 +36,7 @@ import axios from 'axios'; import ThemeLightDark from 'vue-material-design-icons/Brightness6.vue'; import { themeList } from '@/shared/themes'; import { mapActions } from 'vuex'; +import { FTHTMLStyleElement } from '@/types/styleElement'; export default Vue.extend({ name: 'BootswatchThemeSelect', @@ -78,7 +79,7 @@ export default Vue.extend({ ); // Reset all bootswatch styles bw.forEach((style, index) => { - (bw[index] as any).disabled = true; + (bw[index] as FTHTMLStyleElement).disabled = true; }); if (this.simple && this.activeTheme) { // Only transition if simple mode is active @@ -100,10 +101,10 @@ export default Vue.extend({ bw[index].id = themeName; } else if (style.id === themeName) { // If it's a style that has been imported already. - (bw[index] as any).disabled = false; + (bw[index] as FTHTMLStyleElement).disabled = false; } else { // All other style themes should be disabled. - (bw[index] as any).disabled = true; + (bw[index] as FTHTMLStyleElement).disabled = true; } }); }); diff --git a/src/components/ftbot/BotControls.vue b/src/components/ftbot/BotControls.vue index 019f8c10..e6c5a92d 100644 --- a/src/components/ftbot/BotControls.vue +++ b/src/components/ftbot/BotControls.vue @@ -51,7 +51,7 @@ > - + diff --git a/src/types/styleElement.ts b/src/types/styleElement.ts new file mode 100644 index 00000000..4ec70877 --- /dev/null +++ b/src/types/styleElement.ts @@ -0,0 +1,7 @@ +/** + * Workaround style to enable "disabled" element on Style element. + * Can probably be removed in a future Typescript update (once the Root element types disabled correctly). + */ +export interface FTHTMLStyleElement extends HTMLStyleElement { + disabled: boolean; +}