As per the discussion above, simply use `Type.fromValue(type)` here? That will fail if it's `null` or an invalid return value from the server, but it's OK to fail in that case.