Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TypeScript] HomeyAPIxxx.ManagerDevices.Device misses properties (capabilities, capabilitiesObj...) #29

Open
OlivierZal opened this issue Jan 31, 2023 · 2 comments

Comments

@OlivierZal
Copy link

OlivierZal commented Jan 31, 2023

Fact that HomeyAPIV2.ManagerDevices.Device is typed as object raises errors for such lines of code:

const capability: string = 'target_temperature'
const value: any = device.capabilitiesObj[capability]?.value
Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'. ​typescript(7053)
  No index signature with a parameter of type 'string' was found on type '{}'.

or

const value: any = device.capabilitiesObj.target_temperature?.value
Property 'target_temperature' does not exist on type 'object'. ​typescript(2339)
@jeroenwienk
Copy link

I think you mean the problem is that capabilitiesObj is types as any?

@OlivierZal
Copy link
Author

Yes @jeroenwienk, now it's any but before [email protected] it was object.

The problem is that the type Device is not complete, as you can see on the following screenshots:
Property 'capabilities' does not exist on type 'Device'.ts(2339)
Property 'capabilitiesObj' does not exist on type 'Device'.ts(2339)

Capture d’écran 2023-07-24 à 23 25 45 Capture d’écran 2023-07-24 à 23 25 28

@OlivierZal OlivierZal changed the title [TypeScript] HomeyAPIV2.ManagerDevices.Device typed as object [TypeScript] HomeyAPIxxx.ManagerDevices.Device misses properties (capabilities, capabilitiesObj...) Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants