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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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?


/**
* Flushes pending events asynchronously.
Expand Down