function handleData(dataArray: any[]): number[] {
const result: number[] = [];
for (const item of dataArray) {
if (typeof item === 'number') {
result.push(item * item);
} else if (typeof item === 'object' && 'type' in item && item.type === 'object' &&'subProp' in item && typeof item.subProp ==='string') {
result.push(item.subProp.length);
} else if (typeof item === 'object' && 'type' in item && item.type === 'array' &&'subArray' in item && Array.isArray(item.subArray) && item.subArray.every((element) => typeof element === 'number')) {
result.push(item.subArray.reduce((acc, val) => acc + val, 0));
}
}
return result;
}