Upon upgrading from angular 5.1 to 6.1, I started encountering errors in my code, such as the one below:
Error: ngc compilation failed: components/forms/utils.ts(5,3): error TS2322: Type '[number] | [number, number, number, number]' is not assignable to type '[number]'.
Here is the relevant code snippet:
export function bsColumnClass(sizes: [number]) {
let sizebs = ['col-xs-', 'col-sm-', 'col-md-', 'col-lg-',];
sizes = sizes || [12, 12, 12, 12];
let className = sizes.map(function callback(value, index, array) {
return sizebs[index].concat(value.toString());
}).join(" ");
return className;
}
I've identified that the issue lies with the function parameter sizes: [number]
, and specifically this line of code:
sizes = sizes || [12, 12, 12, 12];
Could you suggest a better approach to resolving this problem?