Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Calculadora

0

302
Vistas
How to use AWS Amplify in React Native with Typescript Project?

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?

9 months ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

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);
9 months ago · Santiago Trujillo Denunciar

0

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.

9 months ago · Santiago Trujillo Denunciar

0

I installed this in my typescript project and I have no issue:

 npm install aws-amplify aws-amplify-react-native @react-native-community/netinfo @react-native-async-storage/async-storage

https://docs.amplify.aws/start/getting-started/setup/q/integration/react-native/#initialize-a-new-backend

9 months ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar empleo Planes Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2023 PeakU Inc. All Rights Reserved.