Type is always an empty array. You could return typeId directly. Norbert is right.