didomi / react-native

Didomi SDK for React Native
Other
9 stars 2 forks source link

Incorrect type for `userAuthParams` in `setUserWithAuthParams` #135

Open johankasperi opened 1 month ago

johankasperi commented 1 month ago

https://github.com/didomi/react-native/blob/90b94df9cdcce5df685fcb71203ba3c85e403268/src/Didomi.ts#L616

Shouldn't it be:

userAuthParams: UserAuthParams | UserAuthWithEncryptionParams | UserAuthWithHashParams

so the function accepts for example digest in the params?

pmerlet-at-didomi commented 1 month ago

Hello, UserAuthWithEncryptionParams and UserAuthWithHashParams both extend UserAuthParams. The function should accept digest without issue. Is it not the case?

johankasperi commented 1 month ago

Hello, UserAuthWithEncryptionParams and UserAuthWithHashParams both extend UserAuthParams. The function should accept digest without issue. Is it not the case?

No that is not the case. That is not how TypeScript functions. Just because UserAuthWithEncryptionParams and UserAuthWithHashParams extends UserAuthParams doesn't mean that the function accepts these types.

johankasperi commented 1 month ago

Hello, UserAuthWithEncryptionParams and UserAuthWithHashParams both extend UserAuthParams. The function should accept digest without issue. Is it not the case?

No that is not the case. That is not how TypeScript functions. Just because UserAuthWithEncryptionParams and UserAuthWithHashParams extends UserAuthParams doesn't mean that the function accepts these types.

If I find the time I can make a PR that fixes this

pmerlet-at-didomi commented 1 month ago

No pb, if this fixes the issue:

userAuthParams: UserAuthParams | UserAuthWithEncryptionParams | UserAuthWithHashParams

we can add it to the next release.

johankasperi commented 1 month ago

No pb, if this fixes the issue:

userAuthParams: UserAuthParams | UserAuthWithEncryptionParams | UserAuthWithHashParams

we can add it to the next release.

Yes that will fix the issue