Pushwoosh / pushwoosh-react-native-plugin

Other
57 stars 43 forks source link

chore(index.d): correct parameter type for setTags #143

Closed aidan-24com closed 1 year ago

aidan-24com commented 1 year ago

Hi,

I have picked up a minor typing discrepancy I believe. Please take a look and let me know if anything else is needed.

Thank you

wfhm commented 1 year ago

@aidan-24com Thanks for your contribution! I believe replacing interface with a type is indeed a common and better solution, however, could you please clarify what exactly did you mean by the typing discrepancy? How exactly does it affect your app?

aidan-24com commented 1 year ago

Hello, @wfhm

Our app is giving a linter error for the setTags function.

image

the typing discrepancy is the type of the tags parameter for the setTags function (line 26). If you look at the current release's code, the type is defined as tags: Record<string, PushwooshTags>. I might be wrong, but I think it is supposed to be just the PushwooshTags type, ie tags: PushwooshTags.

I took the opportunity to use the Record<string, ...> syntax, since it was originally used in the setTags definition.

I am more than willing to remove the changes to the PushwooshTags interface. The main point of this PR is to "correct" the typing change to the setTags function.

wfhm commented 1 year ago

@aidan-24com You are right, indeed the types do not match. Thanks again for pointing it out and creating this PR!