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

Invalid types returned from Auth.signIn #3316

Closed
TeoTN opened this issue May 20, 2019 · 4 comments
Closed

Invalid types returned from Auth.signIn #3316

TeoTN opened this issue May 20, 2019 · 4 comments
Labels
Auth Related to Auth components/category feature-request Request a new feature TypeScript Related to TypeScript issues

Comments

@TeoTN
Copy link

TeoTN commented May 20, 2019

Describe the bug
The type returned from Auth.signIn method is Promise<CognitoUser | any> which literally gives no type safety.

From what I see, internally (e.g. here ) the user is assigned dynamically a property that is not in its interface (challengeName).

Expected behavior
I expect types in the library to be precise and correct, and challengeName to be typed as well.

I'd suggest following typing:

export type UserChallenge =
  'CUSTOM_CHALLENGE' |
  'NEW_PASSWORD_REQUIRED' |
  'SMS_MFA' |
  'SOFTWARE_TOKEN_MFA' |
  'MFA_SETUP' |
  undefined;

export interface ISignInResult extends CognitoUser {
  challengeName: UserChallenge;
}
@haverchuck haverchuck added this to the Auth v2 milestone May 21, 2019
@haverchuck haverchuck added Auth Related to Auth components/category enhancement labels May 21, 2019
@manueliglesias manueliglesias added the TypeScript Related to TypeScript issues label May 29, 2019
@sammartinez sammartinez added feature-request Request a new feature and removed enhancement labels Jun 17, 2019
@MichalOsadowski
Copy link

Is anyone looking into this?

@micksatana
Copy link
Contributor

Is anyone looking into this?

I've a fix on the PR above. It'll resolve 3 related issues in the PR.

@abdallahshaban557
Copy link
Contributor

This issue has been resolved! Appreciate you fixing this @micksatana !

@github-actions
Copy link

github-actions bot commented Jul 8, 2023

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server amplify-help forum.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Auth Related to Auth components/category feature-request Request a new feature TypeScript Related to TypeScript issues
Projects
None yet
Development

No branches or pull requests

7 participants