Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update typings for identify() function #102

Merged
merged 1 commit into from
Aug 14, 2018

Conversation

@@ -222,7 +222,7 @@ declare module 'ldclient-js' {
* @param onDone
* A callback to invoke after the user is identified.
*/
identify: (user: LDUser, hash?: string, onDone?: () => void) => Promise<void>;
identify: (user: LDUser, hash?: string, onDone?: (err: Error | null, flags: LDFlagSet | null) => void) => Promise<void>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's a problem here. Looking at the code, when we call resolve from identify(), the parameter is the response body we got from the requestor. That used to be in the format defined by LDFlagSet (key: value), but now it is the larger response from the evalx endpoint (key: { value, version, etc. }). So LDFlagSet is wrong here, even though it's probably what we should be returning. I'm not sure of the right solution. @apucacao?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's possible that non-TS users have already discovered this and are relying on that signature. Given that, can we convert the new response to match LDFlagSet (if possible) and add these definitions?

Copy link
Contributor

@eli-darkly eli-darkly Aug 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But any code that was relying on that signature would not have been working, at least not since we released summary events. So do we break things for people whose code is currently correct, or break things for people who are relying on an out-of-date version?

@robertmassaioli
Copy link

Any updates on this issue? Turning of Typescript type checks when accessing this function is non-ideal. 😄

Copy link
Contributor

@apucacao apucacao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this fix @1999 .

We're going to fix the existing bug separately to ensure that the SDK does in fact pass an LDFlagSet.

@apucacao apucacao merged commit 3889d28 into launchdarkly:master Aug 14, 2018
@eli-darkly eli-darkly mentioned this pull request Aug 15, 2018
@1999 1999 deleted the fix/DAC-XXX-fix-typings branch August 17, 2018 05:11
eli-darkly added a commit that referenced this pull request Sep 27, 2018
change sendLDHeaders to only affect flag requests, not events
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants