The typescript version of the answer in linked question:
function arraysEqual<T>(a: T[] | null, b: T[] | null): bool {
if (a === b) {
return true;
}
if (a == null || b == null || a.length !== b.length) {
return false;
}
// If you don't care about the order of the elements inside
// This is not strict. Need to count the number of every elements if need strict.
// return a.every(i => b.some(i)) && b.every(i => a.some(i));
for (let i = 0; i < a.length; ++i) {
if (a[i] !== b[i]) {
return false;
};
}
return true;
}
For you code:
let props:(string|boolean)[]=['abc','def',true,false,'xyz']
let propsCopied:(string|boolean)[]=['abc','def',true,false,'xyz']
let allPropsCopied:boolean = arraysEqual(props, propsCopied);