Merge pull request #791 from balena-io/remove-type-casts

Remove some type casts
This commit is contained in:
Page- 2018-11-05 10:29:52 +00:00 committed by GitHub
commit 9ac8666ea4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

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

View File

@ -130,7 +130,13 @@ export class RPiConfigBackend extends DeviceConfigBackend {
if (conf[key] == null) {
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;
}