Remove some type casts

Change-type: patch
This commit is contained in:
Pagan Gazzard 2018-11-02 16:44:56 +00:00
parent c66e1aab9d
commit 235f9f04af
2 changed files with 8 additions and 4 deletions

View File

@ -494,7 +494,5 @@ export function normalizeLabels(labels: {
labels, labels,
(_v, k) => !(_.startsWith(k, 'io.balena.') || _.startsWith(k, 'io.resin.')), (_v, k) => !(_.startsWith(k, 'io.balena.') || _.startsWith(k, 'io.resin.')),
); );
return _.assign({}, otherLabels, legacyLabels, balenaLabels) as { return _.assign({}, otherLabels, legacyLabels, balenaLabels);
[key: string]: string;
};
} }

View File

@ -130,7 +130,13 @@ export class RPiConfigBackend extends DeviceConfigBackend {
if (conf[key] == null) { if (conf[key] == null) {
conf[key] = []; conf[key] = [];
} }
(conf[key] as string[]).push(value); const confArr = conf[key];
if (!_.isArray(confArr)) {
throw new Error(
`Expected '${key}' to have a config array but got ${typeof confArr}`,
);
}
confArr.push(value);
} }
continue; continue;
} }