Correctly type StyleElement

This commit is contained in:
Matthias 2021-03-08 07:46:40 +01:00
parent a440c3272e
commit cb780817f3
3 changed files with 12 additions and 4 deletions

View File

@ -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;
}
});
});

View File

@ -51,7 +51,7 @@
>
<PlayIcon />
</button>
<ForceBuyForm :modal-show="forcebuyShow" @close="this.$bvModal.hide('forcebuy-modal')" />
<ForceBuyForm :modal-show="forcebuyShow" @close="$bvModal.hide('forcebuy-modal')" />
</div>
</div>
</template>

View File

@ -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;
}