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

Discrepancy between getDeviceList types and usage #27

Open
themakshter opened this issue Jul 5, 2020 · 0 comments
Open

Discrepancy between getDeviceList types and usage #27

themakshter opened this issue Jul 5, 2020 · 0 comments

Comments

@themakshter
Copy link

The typing for getDeviceList is as follows:

  /**
   * Returns the device list via Promise
   *
   * @returns {Promise<Device>}
   * @memberof RNSerialportStatic
   */
  getDeviceList(): Promise<Devices>;

However, when I see usage, the promise seems to be returning response object which tends to contain the devices object.

RNSerialport.getDeviceList((response) => {
  if(!response.status) {
    response.log("Error from getDeviceList()", response.errorCode + " " + response.errorMessage)
    return;
  }
  console.log(response.devices)//list
});

Looking through the code, it's clearly returning the devices in its promise resolution and then returning only errorCode and errorMessage.

Could an interface for only those two be added to the typings and also the examples be fixed? Happy to help

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