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

Incorrect type when calling find with a single address #74

Open
JordanDC2 opened this issue Jan 23, 2025 · 0 comments
Open

Incorrect type when calling find with a single address #74

JordanDC2 opened this issue Jan 23, 2025 · 0 comments

Comments

@JordanDC2
Copy link

JordanDC2 commented Jan 23, 2025

In the following snippet, foundDevice is typed as find.IDevice[] when it is rather simply a find.IDevice

find({ address: "192.168.1.1" }).then((foundDevice) => {})

This naturally causes issues with typescript and intellisense that must be fixed by casting foundDevice to unknown and then casting it again to find.IDevice to achieve the actual type.

It would be ideal if this function would propertly type the return type, or type it as the following: IDevice | IDevice[].
This union type would allow type narrowing the return value to the proper type.

Image

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant