athombv / homey-web-api-issues

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

[TypeScript] `homey-api.d.ts` is broken on 3.0.5 #34

Closed OlivierZal closed 1 year ago

OlivierZal commented 1 year ago

TypeScript compilation fails because of this:

Capture d’écran 2023-07-06 à 23 49 49
spkesDE commented 1 year ago

Same for me.

jeroenwienk commented 1 year ago

Could you guys lets me know if it's fixed in 3.0.6?

jeroenwienk commented 1 year ago

I also noticed the api does not have any manager types on homey.somemanager. How did you guys work around this? Seems that alot of stuff is not working propertly for ts.

spkesDE commented 1 year ago

With //ts-ignore 😅

Will test 3.0.6 later, once I‘m home

OlivierZal commented 1 year ago

I will test when I am home.

For now I ts-expect-error

OlivierZal commented 1 year ago

And I think that some quick wins could be done for signature errors

For examples: https://github.com/athombv/homey-web-api-issues/issues/33

OlivierZal commented 1 year ago

Or https://github.com/athombv/homey-web-api-issues/issues/28 and https://github.com/athombv/homey-web-api-issues/issues/27

And a last one:

Current definition: new HomeyAPIApp(this.homey, false);

Right definition: new HomeyAPIApp({ homey: this.homey, debug?: false })

jeroenwienk commented 1 year ago

I will see if I can address those first

OlivierZal commented 1 year ago

Thanks a lot!

I say these are quick wins because @spkesDE and I give you the way to solve. 😀

OlivierZal commented 1 year ago

@jeroenwienk, many thanks 3.0.7 solves the issue and works perfect!

A version 3.0.8 with the following would be even more perfect 😀

setCapabilityValue(
  opts: {
    capabilityId: string,
    value: number | boolean | string,
    opts?: {
      duration?: number,
    }
  }
)

By the way, how does duration work, I haven’t seen it documented somewhere…

jeroenwienk commented 1 year ago

setCapabilityValue

Not sure what you mean that is the signature currently?

OlivierZal commented 1 year ago

Currently it's:

setCapabilityValue(
  opts: {
    capabilityId: string,
    value: number | boolean | string,
    opts: {
      duration: number,
    }
  }
)

where opts: { duration: number } is mandatory

Since opts is optional (the code works without it...), there is a missing ?

OlivierZal commented 1 year ago

Anyway, this issue is solved, I will create different tasks for the pending issues. Thanks!