Closed connorpmullins closed 5 months ago
Hey @connorpmullins,
I understand that you want a better way to fetch the anonymousId
.
However, any value you set by calling our identify API is stored in traits
. Since users can pass various types (String, Integer, Objects, etc.), we have defined the traits
type as Record<string, unknown>
. Therefore, it's not possible for us to change that.
As a temporary workaround, you can convert that value to a String.
A better solution would be for us to introduce a getAnonymousId
API, which will return the anonymousId
as a string. This API can be called after the SDK is initialized. I can forward this request to our team, and we will ensure to implement it in the future.
Please let me know if you have any further questions!
Thanks @1abhishekpandey !
Super helpful - mind updating here if/when getAnonymousId
gets implemented?
Thank you!
Hi there, I'm working in a react native project using version
1.13.1
of the"@rudderstack/rudder-sdk-react-native"
SDK.ISSUE: In the below code you can see a red typescript warning
The error is that
Type 'unknown' is not assignable to type 'string'
.PROPOSED SOLUTION:
traits
more strictly thanRecord<string, unknown>
? I'm not sure what other values exist in traits, but manually typingunknown as string
on my end is both a pain and unsafe.EXTRA REQUEST: