简体   繁体   English

"如何将 aws-Amplify 身份验证添加到 react-native typescript 项目模板"

[英]How to add aws-Amplify authentication to react-native typescript project template

I'm trying to add Amplify Authentication in my react native project that uses Typescript template .我正在尝试在使用 Typescript 模板的 react 本机项目中添加 Amplify Authentication 。 There is a package given in amplify documentation 'aws-amplify-react-native' which is used as a middleware to authenticate our application.放大文档“aws-amplify-react-native”中给出了一个包,它用作验证我们应用程序的中间件。 But this package is only supported in projects which are based on javascript not Typescript.但是这个包仅在基于 javascript 而不是 Typescript 的项目中受支持。 For Typescript it shows an error like对于 Typescript,它显示一个错误,例如

Could not find a declaration file for module 'aws-amplify-react-native'.找不到模块“aws-amplify-react-native”的声明文件。 '/home/george/ELab/node_modules/aws-amplify-react-native/dist/index.js' implicitly has an 'any' type. '/home/george/ELab/node_modules/aws-amplify-react-native/dist/index.js' 隐含了一个 'any' 类型。 Try npm i --save-dev @types/aws-amplify-react-native if it exists or add a new declaration (.d.ts) file containing `declare module 'aws-amplify-react-native'如果存在,请尝试npm i --save-dev @types/aws-amplify-react-native或添加一个包含 `declare module 'aws-amplify-react-native' 的新声明 (.d.ts) 文件

There is no package available like '@types/aws-amplify-react-native'没有像“@types/aws-amplify-react-native”这样的软件包

and I have read through the post of other developer who are facing similar problem like this but the was no answer provide can some one please , I beg you help me out here this problem I been trying to fix it for two weeks now我已经阅读了其他面临类似问题的开发人员的帖子,但是没有人可以提供任何答案,我求你帮我解决这个问题,我已经尝试修复两周了

在根文件夹中创建一个新的“aws-amplify-react-native.d.ts”类型文件并粘贴此模块

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM