Azure / Azure/azure-iot-sdk-node

TypeScript types for the `azure-iot-provisioning-service` library appear to be incorrect

Open
#1,199 8 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
268
Forks
228
PR merge metrics
No merged PRs in 30d

Description

In the last hour I have encountered two scenarios where the TypeScript types are completely incorrect for the `azure-iot-provisioning-service` library.

This is the version I am using:
```
"azure-iot-provisioning-service": "^1.11.2"
```

1. The `createOrUpdateIndividualEnrollment` method on the client takes an `IndividualEnrollment` object as input. The `IndividualEnrollment` object does not consider any of the fields optional, despite the fact that the endpoint will accept a very small subset of fields. Why is there not a separate input type which accurately reflects which fields are required?

2. The `createIndividualEnrollmentQuery` method on the client returns a `Query` object. The user is then supposed to call the `Query` object's `next` method to receive result pages. The type annotations for this `next` method indicate that the returned object has a `responseBody` property of the form `{ items: Array }`, but the actual value returned from the API is the items array directly.

Based on the limited testing I have done, I am certain that there would be other areas where types are incorrect. Is this a matter of re-generating these types from the underlying API specification? What can be done to resolve this?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.