Skip to content

Commit 1b72997

Browse files
committed
Added type hints on authService.ts to avoid "No overload matches this call." error
1 parent 054c03e commit 1b72997

File tree

1 file changed

+6
-3
lines changed
  • javascriptv3/example_code/cognito-identity-provider/scenarios/cognito-developer-guide-react-example/frontend-client/src

1 file changed

+6
-3
lines changed

javascriptv3/example_code/cognito-identity-provider/scenarios/cognito-developer-guide-react-example/frontend-client/src/authService.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import {
66
InitiateAuthCommand,
77
SignUpCommand,
88
ConfirmSignUpCommand,
9+
type InitiateAuthCommandInput,
10+
type SignUpCommandInput,
11+
type ConfirmSignUpCommandInput,
912
} from "@aws-sdk/client-cognito-identity-provider";
1013
import config from "./config.json";
1114

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

1619
export const signIn = async (username: string, password: string) => {
17-
const params = {
20+
const params: InitiateAuthCommandInput = {
1821
AuthFlow: "USER_PASSWORD_AUTH",
1922
ClientId: config.clientId,
2023
AuthParameters: {
@@ -44,7 +47,7 @@ export const signIn = async (username: string, password: string) => {
4447
};
4548

4649
export const signUp = async (email: string, password: string) => {
47-
const params = {
50+
const params: SignUpCommandInput = {
4851
ClientId: config.clientId,
4952
Username: email,
5053
Password: password,
@@ -67,7 +70,7 @@ export const signUp = async (email: string, password: string) => {
6770
};
6871

6972
export const confirmSignUp = async (username: string, code: string) => {
70-
const params = {
73+
const params: ConfirmSignUpCommandInput = {
7174
ClientId: config.clientId,
7275
Username: username,
7376
ConfirmationCode: code,

0 commit comments

Comments
 (0)