braze-inc / braze-web-sdk

Public repo for the Braze Web SDK
https://www.braze.com
Other
70 stars 25 forks source link

[Bug]: subscribeToSdkAuthenticationFailures type declarations incorrect #138

Closed gilesbain-motorway closed 1 year ago

gilesbain-motorway commented 1 year ago

Braze Web SDK Version

4.6.3

Integration Method

NPM

Browser

Chrome

Steps To Reproduce

import braze from "@braze/web-sdk"

// init braze

subscribeToSdkAuthenticationFailures(async (error): Promise<void> => {
    console.log({ error });
    console.log(typeof error.errorCode);
  });

braze.changeUser(123, 'signedBrazeSignature');

Expected Behavior

errorCode to be of type string.

Actual Incorrect Behavior

errorCode is of type number contrary to the declaration file:

export function subscribeToSdkAuthenticationFailures(subscriber: (
    error: {
      errorCode: string,
      reason?: string,
      userId?: string,
      signature?: string
    }
  ) => void): string | undefined;

Verbose Logs

No response

Additional Information

image

Demonstration of similar to above code

wesleyorbin commented 1 year ago

Hi @gilesbain-motorway. Thanks for bringing this to our attention. We'll fix this in the upcoming release.

gilesbain-motorway commented 1 year ago

@wesleyorbin Great thanks. Do you know if it will be fixed by changing the declaration to be number or by ensuring it is a string?

wesleyorbin commented 1 year ago

It will be fixed by changing the declaration to be number

gilesbain-motorway commented 1 year ago

👍 Thanks for the quick response.