Extend tag element definition to avoid some cast (#34)
This commit is contained in:
@@ -7,7 +7,6 @@ import {
|
|||||||
handleAction,
|
handleAction,
|
||||||
LovelaceCardEditor,
|
LovelaceCardEditor,
|
||||||
getLovelace,
|
getLovelace,
|
||||||
LovelaceCard,
|
|
||||||
} from 'custom-card-helpers';
|
} from 'custom-card-helpers';
|
||||||
|
|
||||||
import './editor';
|
import './editor';
|
||||||
@@ -36,7 +35,7 @@ console.info(
|
|||||||
@customElement('boilerplate-card')
|
@customElement('boilerplate-card')
|
||||||
export class BoilerplateCard extends LitElement {
|
export class BoilerplateCard extends LitElement {
|
||||||
public static async getConfigElement(): Promise<LovelaceCardEditor> {
|
public static async getConfigElement(): Promise<LovelaceCardEditor> {
|
||||||
return document.createElement('boilerplate-card-editor') as LovelaceCardEditor;
|
return document.createElement('boilerplate-card-editor');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static getStubConfig(): object {
|
public static getStubConfig(): object {
|
||||||
@@ -104,7 +103,7 @@ export class BoilerplateCard extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private showError(error: string): TemplateResult {
|
private showError(error: string): TemplateResult {
|
||||||
const errorCard = document.createElement('hui-error-card') as LovelaceCard;
|
const errorCard = document.createElement('hui-error-card');
|
||||||
errorCard.setConfig({
|
errorCard.setConfig({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
error,
|
error,
|
||||||
|
|||||||
+8
-1
@@ -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
|
// TODO Add your configuration elements here for type-checking
|
||||||
export interface BoilerplateCardConfig extends LovelaceCardConfig {
|
export interface BoilerplateCardConfig extends LovelaceCardConfig {
|
||||||
|
|||||||
Reference in New Issue
Block a user