Typeof dynamic properties in object

Hi,

I have a complex object with nested objects and arrays in it. I’ve made a clone function which makes a copy of it instead of a reference so I can keep the original one intact while i change the properties in the clone as such:


static public function clone (original:Object):* {
	var ba:ByteArray = new ByteArray();
	ba.writeObject(original);
	ba.position = 0;
	return ba.readObject();
}

All this is working fine so far but the problem is that all the nested arrays inside the object have a value type of object (since they’re dynamic). So lets say:


originalObject.someArray = ['apple', 'orange'];

trace(typeof(originalObject.someArray));

it traces “object”.

Any ideas on how I can have the object’s dynamic properties properly typed?

Thanks in advance.