Skip to content

Commit

Permalink
fix(config_templates): Was supposed to support a string
Browse files Browse the repository at this point in the history
  • Loading branch information
RomRider committed Feb 15, 2021
1 parent 9108444 commit f36d9b1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/apexcharts-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,11 @@ class ChartsCard extends LitElement {
delete (configDup as any).entities;
}
configDup = configDup as ChartCardExternalConfig;
if (configDup.config_templates && configDup.config_templates.length > 0) {
if (configDup.config_templates) {
configDup.config_templates =
configDup.config_templates && Array.isArray(configDup.config_templates)
? configDup.config_templates
: [configDup.config_templates];
configDup = mergeConfigTemplates(getLovelace(), configDup);
}
try {
Expand Down
2 changes: 1 addition & 1 deletion src/types-config-ti.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as t from "ts-interface-checker";

export const ChartCardExternalConfig = t.iface([], {
"type": t.lit('custom:apexcharts-card'),
"config_templates": t.opt(t.array("string")),
"config_templates": t.opt(t.union(t.array("string"), "string")),
"color_list": t.opt(t.array("string")),
"locale": t.opt("string"),
"experimental": t.opt(t.iface([], {
Expand Down
2 changes: 1 addition & 1 deletion src/types-config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export interface ChartCardExternalConfig {
type: 'custom:apexcharts-card';
config_templates?: string[];
config_templates?: string[] | string;
color_list?: string[];
locale?: string;
experimental?: {
Expand Down

0 comments on commit f36d9b1

Please sign in to comment.