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

JavaScript: Cognito - Add type annotation on authService.ts #7123

Merged

Conversation

NathanCYee
Copy link
Contributor

When running npm run build on the project, the build fails due to the following error:

src/authService.ts:26:45 - error TS2769: No overload matches this call.
  Overload 1 of 2, '(input: InitiateAuthCommandInput): InitiateAuthCommand', gave the following error.
    Argument of type '{ AuthFlow: string; ClientId: string; AuthParameters: { USERNAME: string; PASSWORD: string; }; }' is not assignable to parameter of type 'InitiateAuthCommandInput'.
      Types of property 'AuthFlow' are incompatible.
        Type 'string' is not assignable to type 'AuthFlowType'.
  Overload 2 of 2, '(__0_0: InitiateAuthCommandInput): InitiateAuthCommand', gave the following error.
    Argument of type '{ AuthFlow: string; ClientId: string; AuthParameters: { USERNAME: string; PASSWORD: string; }; }' is not assignable to parameter of type 'InitiateAuthCommandInput'.
      Types of property 'AuthFlow' are incompatible.
        Type 'string' is not assignable to type 'AuthFlowType'.

26     const command = new InitiateAuthCommand(params);

By adding type annotations, TypeScript does not complain on the line. Added annotations on every other API call as well for consistency.

@github-actions github-actions bot added the Javascript-v3 This issue relates to the AWS SDK for Javascript V3 label Dec 4, 2024
@beqqrry-aws beqqrry-aws self-assigned this Dec 5, 2024
@beqqrry-aws beqqrry-aws added Bug An update to fix incorrect code or typos. On Call Review needed This work needs an on-call review labels Dec 5, 2024
@rlhagerm rlhagerm added On Call Review complete On call review complete and removed On Call Review needed This work needs an on-call review labels Dec 9, 2024
@rlhagerm rlhagerm force-pushed the js_cognito_authservice_add_type_hint branch from aa0cb55 to 39d8133 Compare December 9, 2024 15:12
@rlhagerm rlhagerm merged commit 94633d5 into awsdocs:main Dec 9, 2024
15 checks passed
@NathanCYee NathanCYee deleted the js_cognito_authservice_add_type_hint branch December 9, 2024 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug An update to fix incorrect code or typos. Javascript-v3 This issue relates to the AWS SDK for Javascript V3 On Call Review complete On call review complete
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants