Amplify-js: CognitoUser TypeScript definition missing challengeName

Created on 25 Jul 2019  路  5Comments  路  Source: aws-amplify/amplify-js

Describe the bug
The CognitoUser TS definition exported from @aws-amplify/auth is missing challengeName on its interface, so whenever I try to check user.challengeName, I receive an error

Expected behavior
challengeName should be included in type definition for CognitoUser

Error

Property 'challengeName' does not exist on type 'CognitoUser'.

Dependencies:

  • @aws-amplify/auth: 1.2.28

Sample code
Sandbox: https://codesandbox.io/s/cognitouser-issue-hd7y1 (check src/index.ts file)

Auth TypeScript good first issue pending-close-response-required

Most helpful comment

@iamkevinwolf I can confirm this is still an ongoing issue as I've only just come across it. Its probably been abit too long for this reply to be of any good to you but for the interim as a quick fix i've resorted to the following:

export type AuthChallengeName =
  | "NEW_PASSWORD_REQUIRED"
  | "SMS_MFA"
  | "SOFTWARE_TOKEN_MFA"
  | "MFA_SETUP";

export type AuthUser =  CognitoUser & {
  challengeName: AuthChallengeName
}

furthermore, challengeParam is also not yet defined.....

All 5 comments

Related to #3316

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This issue has been automatically closed because of inactivity. Please open a new issue if are still encountering problems.

@iamkevinwolf I can confirm this is still an ongoing issue as I've only just come across it. Its probably been abit too long for this reply to be of any good to you but for the interim as a quick fix i've resorted to the following:

export type AuthChallengeName =
  | "NEW_PASSWORD_REQUIRED"
  | "SMS_MFA"
  | "SOFTWARE_TOKEN_MFA"
  | "MFA_SETUP";

export type AuthUser =  CognitoUser & {
  challengeName: AuthChallengeName
}

furthermore, challengeParam is also not yet defined.....

Stills missing on version 3.3.2

Was this page helpful?
0 / 5 - 0 ratings