mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-26 14:27:20 +00:00
Add return types
This commit is contained in:
parent
5617416932
commit
d0acef3ecb
@ -8,6 +8,7 @@ import { longPress } from "../common/directives/long-press-directive";
|
|||||||
import { hassLocalizeLitMixin } from "../../../mixins/lit-localize-mixin";
|
import { hassLocalizeLitMixin } from "../../../mixins/lit-localize-mixin";
|
||||||
import { LovelaceElement, LovelaceElementConfig } from "./types.js";
|
import { LovelaceElement, LovelaceElementConfig } from "./types.js";
|
||||||
import { HomeAssistant } from "../../../types.js";
|
import { HomeAssistant } from "../../../types.js";
|
||||||
|
import { TemplateResult } from "lit-html";
|
||||||
|
|
||||||
interface Config extends LovelaceElementConfig {
|
interface Config extends LovelaceElementConfig {
|
||||||
icon: string;
|
icon: string;
|
||||||
@ -22,7 +23,7 @@ export class HuiIconElement extends hassLocalizeLitMixin(LitElement)
|
|||||||
return { hass: {}, _config: {} };
|
return { hass: {}, _config: {} };
|
||||||
}
|
}
|
||||||
|
|
||||||
public setConfig(config: Config) {
|
public setConfig(config: Config): void {
|
||||||
if (!config.icon) {
|
if (!config.icon) {
|
||||||
throw Error("Invalid Configuration: 'icon' required");
|
throw Error("Invalid Configuration: 'icon' required");
|
||||||
}
|
}
|
||||||
@ -30,7 +31,7 @@ export class HuiIconElement extends hassLocalizeLitMixin(LitElement)
|
|||||||
this._config = config;
|
this._config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render() {
|
protected render(): TemplateResult {
|
||||||
if (!this._config) {
|
if (!this._config) {
|
||||||
return html``;
|
return html``;
|
||||||
}
|
}
|
||||||
@ -47,7 +48,7 @@ export class HuiIconElement extends hassLocalizeLitMixin(LitElement)
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderStyle() {
|
private renderStyle(): TemplateResult {
|
||||||
return html`
|
return html`
|
||||||
<style>
|
<style>
|
||||||
:host {
|
:host {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user