Skip to content
This repository was archived by the owner on Sep 21, 2023. It is now read-only.

Conversation

@domdomegg
Copy link

Currently we have a code property on the GoogleLoginResponse interface that isn't actually there and is just a hack for people doing the offline flow. Additionally, if using the online flow in TypeScript you can't safely access any of the properties and need to cast the argument of the onSuccess callback to get them.

This PR fixes these issues by properly handling the responseType property that determines what the onSuccess callback's argument is.

This allows us to do this in TypeScript without errors (currently, this errors as TypeScript is not sure whether res is a GoogleLoginResponse or a GoogleLoginResponseOffline):

image

While still erroring about bad property accesses when the responseType is code:

image

But of course still allowing us to get the code when responseType is code:

image

Currently we have a `code` property on the `GoogleLoginResponse` interface that isn't actually there and is just a hack for people doing the offline flow. Additionally, if using the online flow in TypeScript you can't safely access any of the properties and need to cast the argument of the onSuccess callback to get them.

This PR fixes these issues by properly handling the `responseType` property that determines what the `onSuccess` callback's argument is.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants