amplify-js: AuthState is not exported from @aws-amplify/ui-components
Describe the bug
In a typescript based react app, when using the AmplifyAuthenticator, i’d like to change the initalAuthState parameter, described here https://docs.amplify.aws/ui/auth/authenticator?framework=react#prop-initial-auth-state. However, the enum AuthState from ui-components is not exported so typescript fails with an error similar to: node_modules/@aws-amplify/ui-components/dist/types/components"' declares 'AuthState' locally, but it is not exported.
To Reproduce Steps to reproduce the behavior:
- Create a CRA app with a typescript template
- import AmplifyAuthenticator into the App.tsx.
- add the initalAuthState property to AmplifyAuthenticator like
<AmplifyAuthenticator usernameAlias="email" initialAuthState={AuthState.SignUp> - See error
Expected behavior User should be able to import AuthState enum and use it for initalAuthState
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 18 (5 by maintainers)
Using@aws-amplify/ui-react@unstableworked for me as well. ThanksNope, I got another error now.
Also getting this error when using version:
^0.2.19in package.json, installed version0.2.19Attempted import error: 'AuthErrorStrings' is not exported from '@aws-amplify/auth'.Edit / update: This error is from using
withAuthenticatorfrom@aws-amplify/authin a Next.js page. I just tested this in a SPA using Create React App and it works fine.Edit # 2: After removing my node_modules and re-installing, it also works fine in my Next.js app.
Sorry about the delay. The unstable package worked for me, thanks.