Closed borisilic-ap closed 1 year ago
@borisilic-ap thanks for reporting this. We are investigating this and will provide an update shortly. Logged internally as 193181.
Thank you!
I'm back. I'm a little wary of the solution as it is now. It depends on developers reading the documentation to know to specify the key unless anonymous
is true
rather than the behaviour being enforced by typescript.
Is it possible to implement something along these lines instead: https://stackoverflow.com/a/51412935
Type aliases are great but is not trivial to change our code base right now to do that. Th anonymous and key props are defined in the common sdk as an interface which are extended elsewhere. Changing this to be a type
mean we'll have to re-defined those other interfaces as well. As such, we'll have to stick to the current solution for now and depend on the documentation.
Is this a support request? No.
Describe the bug With regards to anonymous users there's a mismatch between what the docs say (https://docs.launchdarkly.com/sdk/client-side/javascript/migration-2-to-3#understanding-changes-to-anonymous-users)
and what the typescript interfaces enforce: (https://launchdarkly.github.io/js-client-sdk/interfaces/LDContextCommon.html).
According to the docs to enable an anonymous user one would omit the
key
property from the context and setanonymous: true
. But omitting thekey
property causes TS to complain due to it being required.Thoughts?
Expected behavior Define an anonymous context by being able to omit the
key
property.SDK version
"launchdarkly-react-client-sdk": "^3.0.0"
Language version, developer tools React.