athombv / homey-web-api-issues

This issue tracker is for Homey Developers using the Web API.
4 stars 1 forks source link

[TypeScript] `HomeyAPIxxx.ManagerDevices.Device.setCapabilityValue` signature error #28

Closed OlivierZal closed 1 year ago

OlivierZal commented 1 year ago
setCapabilityValue(
  opts: {
    capabilityId: string,
    value: number | boolean | string,
    opts: {
      duration: number,
    },
)

should rather be:

setCapabilityValue(
  opts: {
    capabilityId: string,
    value: number | boolean | string,
    // The part below is not necessary to make the function work
    opts?: {
      duration?: number,
    },
)
jeroenwienk commented 1 year ago

This one seems correct. You should always use the type of V3.

OlivierZal commented 1 year ago

@jeroenwienk, my bad, I wrote the wrong way.

My point is that the function works well without the (second) opts, what means that it needs to be marked as optional in the definition:

opts?: {
  duration?: number,
}

I've updated the description accordingly with the following:

setCapabilityValue(
  opts: {
    capabilityId: string,
    value: number | boolean | string,
    opts?: {
      duration?: number,
    }
  }
)
jeroenwienk commented 1 year ago

It is marked as optional in the types.

OlivierZal commented 1 year ago

I don't know when it has been solved but now it's good. Thanks!