Stricter class-based typing for objects