amplify-js icon indicating copy to clipboard operation
amplify-js copied to clipboard

fix(auth): Missing type in configure function

Open micksatana opened this issue 2 years ago • 3 comments

Description of changes

Screen Shot 2565-06-30 at 23 35 40 Missing type when using `Auth.configure`

Description of how you validated changes

Screen Shot 2565-07-01 at 00 28 20

In VSCode

Checklist

  • [x] PR description included
  • [x] yarn test passes
  • [x] Tests are changed or added
  • [x] Relevant documentation is changed or added (and PR referenced)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

micksatana avatar Jun 30 '22 17:06 micksatana

Hi guys, can we have one more approver here? It's a simple change, won't take long to review.

micksatana avatar Jul 16 '22 15:07 micksatana

@micksatana, Thanks for your contribution and also updating the docs at the same time.

chintannp avatar Jul 20 '22 17:07 chintannp

@micksatana Looks like we need to fix one of the tests to account for the added type

● Test suite failed to run
@aws-amplify/auth:     TypeScript diagnostics (customize using `[jest-config].globals.ts-jest.diagnostics` option):
@aws-amplify/auth:     __tests__/auth-configure-test.ts:16:19 - error TS2345: Argument of type '{ userPoolId: string; userPoolWebClientId: string; region: string; identityPoolId: string; mandatorySignIn: boolean; storage: {}; }' is not assignable to parameter of type 'AuthOptions'.
@aws-amplify/auth:       Types of property 'storage' are incompatible.
@aws-amplify/auth:         Type '{}' is missing the following properties from type 'ICognitoStorage': setItem, getItem, removeItem, clear
@aws-amplify/auth:     16  		auth.configure(opts);

chrisbonifacio avatar Jul 21 '22 15:07 chrisbonifacio

Hi @micksatana - thank you for this contribution! We are currently working on improving our TS types, including adding support for typing the configure function. You can check out our RFC proposal here

abdallahshaban557 avatar Aug 15 '23 19:08 abdallahshaban557