Extend tag element definition to avoid some cast (#34)

This commit is contained in:
Jérôme Steunou
2020-10-20 21:12:54 -05:00
committed by GitHub
parent 396e90b451
commit 55a5fdede6
2 changed files with 10 additions and 4 deletions
+2 -3
View File
@@ -7,7 +7,6 @@ import {
handleAction,
LovelaceCardEditor,
getLovelace,
LovelaceCard,
} from 'custom-card-helpers';
import './editor';
@@ -36,7 +35,7 @@ console.info(
@customElement('boilerplate-card')
export class BoilerplateCard extends LitElement {
public static async getConfigElement(): Promise<LovelaceCardEditor> {
return document.createElement('boilerplate-card-editor') as LovelaceCardEditor;
return document.createElement('boilerplate-card-editor');
}
public static getStubConfig(): object {
@@ -104,7 +103,7 @@ export class BoilerplateCard extends LitElement {
}
private showError(error: string): TemplateResult {
const errorCard = document.createElement('hui-error-card') as LovelaceCard;
const errorCard = document.createElement('hui-error-card');
errorCard.setConfig({
type: 'error',
error,
+8 -1
View File
@@ -1,4 +1,11 @@
import { ActionConfig, LovelaceCardConfig } from 'custom-card-helpers';
import { ActionConfig, LovelaceCard, LovelaceCardConfig, LovelaceCardEditor } from 'custom-card-helpers';
declare global {
interface HTMLElementTagNameMap {
'boilerplate-card-editor': LovelaceCardEditor;
'hui-error-card': LovelaceCard;
}
}
// TODO Add your configuration elements here for type-checking
export interface BoilerplateCardConfig extends LovelaceCardConfig {