This should be fairly simple, but I just can't get it sorted - I have the following definition:
export interface IUnit {
    id: number;
    name: string;
    //further members;
}
export class Unit implements IUnit {
    id: number;
    name: string;
    //...
}
export interface IUnits { [id: string]: IUnit; }
export class Units implements IUnits { [id: string]: Unit; }
Now, if I have a variable of the type IUnits, e.g.
var x: IUnits = { 
    "1": {"id": 1, "name": "First"}, 
    "2": {"id": 2, "name": "Second"}
};
, how can I determine the number of it's members? x.length(); does not work. I guess I could use for ... in ..., but this seems horribly inefficient...
 
     
    