I'm trying to add Amplify Authentication in my react native project which uses typescript. There is a package given in amplify documentation 'aws-amplify-react-native' which is used as a middleware to authenticate our application. But this package is only supported in projects which are based on javascript. For Typescript it shows an error like
Could not find a declaration file for module 'aws-amplify-react-native'.
Try `npm install @types/aws-amplify-react-native` if it exists or add a new declaration (.d.ts) file containing `declare module 'aws-amplify-react-native';`
There is no package available like '@types/aws-amplify-react-native'
So anyone can help me out of this?
Q: What languages and platforms do Amplify libraries support? Amplify libraries support iOS, Android, Web, Flutter, and React Native apps. For Web apps, there is deep integration with React, Ionic, Angular, and Vue. js.
Deploy and Host a React App (10 minutes): Create a React app and deploy and host through AWS Amplify. Initialize a Local App (5 minutes): Initialize a local app using AWS Amplify. Add Authentication (10 minutes): Add auth to your application. Add a GraphQL API and Database (15 minutes): Create a GraphQL API.
Unfortunately there are no defined types at the time of this answer. However, you can invoke @ts-ignore
like so
// @ts-ignore
import Amplify, { Auth } from 'aws-amplify';
// @ts-ignore
import awsconfig from './aws-exports';
// @ts-ignore
import { withAuthenticator } from 'aws-amplify-react-native'
Amplify.configure(awsconfig);
There are no official TypeScript (TS) types available for aws-amplify-react-native at the moment. To suppress the TypeScript warning, you need to define your own TS declaration file (*.d.ts).
To get approximate typings, you can copy this file into your project. These are typings written by the GitHub user dantasfiles. Bear in mind that they are not exact and could be specified more precisely.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With