Skip to content

Commit

Permalink
JavaScript: Cognito - Add type annotation on authService.ts (#7123)
Browse files Browse the repository at this point in the history
Added type hints on authService.ts to avoid "No overload matches this call." error
  • Loading branch information
NathanCYee authored Dec 9, 2024
1 parent e692fd9 commit 94633d5
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import {
InitiateAuthCommand,
SignUpCommand,
ConfirmSignUpCommand,
type InitiateAuthCommandInput,
type SignUpCommandInput,
type ConfirmSignUpCommandInput,
} from "@aws-sdk/client-cognito-identity-provider";
import config from "./config.json";

Expand All @@ -14,7 +17,7 @@ export const cognitoClient = new CognitoIdentityProviderClient({
});

export const signIn = async (username: string, password: string) => {
const params = {
const params: InitiateAuthCommandInput = {
AuthFlow: "USER_PASSWORD_AUTH",
ClientId: config.clientId,
AuthParameters: {
Expand Down Expand Up @@ -44,7 +47,7 @@ export const signIn = async (username: string, password: string) => {
};

export const signUp = async (email: string, password: string) => {
const params = {
const params: SignUpCommandInput = {
ClientId: config.clientId,
Username: email,
Password: password,
Expand All @@ -67,7 +70,7 @@ export const signUp = async (email: string, password: string) => {
};

export const confirmSignUp = async (username: string, code: string) => {
const params = {
const params: ConfirmSignUpCommandInput = {
ClientId: config.clientId,
Username: username,
ConfirmationCode: code,
Expand Down

0 comments on commit 94633d5

Please sign in to comment.