TuyaAPI / openapi

🚪 a wrapper for Tuya's OpenAPI
https://github.com/TuyaAPI/openapi/blob/master/docs/classes/api.openapi.md
MIT License
20 stars 13 forks source link

Inconsistency in typings #5

Closed milo526 closed 3 years ago

milo526 commented 3 years ago

The getDeviceToken method of this library has a return type of Promise<string>

While after link library fetches it it is treated as an object.

Logically it can't be both 😛

milo526 commented 3 years ago

To the best of my knowledge and testing, the provided value is indeed an object.

I propose a change in the typings of the openapi library with extra validation to ensure that the return type is indeed an object. We could even chose to validate that all the properties are indeed present.

codetheweb commented 3 years ago

You're correct.

I don't think validation is necessary, but an update that changes all those Object typings to proper interfaces would be appreciated as well. Guess I was just lazy when I was originally making this since downstream consumers weren't using Typescript. 😛