amazon-cognito-auth-js icon indicating copy to clipboard operation
amazon-cognito-auth-js copied to clipboard

Typing Issues related to amazon-cognito-auth-js

Open manueliglesias opened this issue 7 years ago • 4 comments

From: aws/aws-amplify#737


Do you want to request a feature or report a bug? Report a bug

What is the current behavior? After installing AWS Amplify & AWS Amplify React on a newly created create-react-app Typescript application and importing AWS Amplify in my App.tsx, I get the following error:

C:/Users/***/***/project/node_modules/aws-amplify/lib/Common/Facet.d.ts
(6,34): Could not find a declaration file for module 'amazon-cognito-auth-js'. 'C:/Users/***/***/project/node_modules/amazon-cognito-auth-js/lib/index.js' implicitly has an 'any' type.
  Try `npm install @types/amazon-cognito-auth-js` if it exists or add a new declaration (.d.ts) file containing `declare module 'amazon-cognito-auth-js';`

Which versions of Amplify, and which browser / OS are affected by this issue? Did this work in previous versions? I'm using the AWS-Amplify ^0.3.3, AWS-Amplify-React ^0.1.43. Also tried using [email protected].

Is this a bug with the library? Is there a way to bypass/fix this?

manueliglesias avatar Apr 27 '18 02:04 manueliglesias

Request: generate typescript type definitions

manueliglesias avatar Apr 27 '18 02:04 manueliglesias

I assume type definitions need to be created, or at least polished, by hand.

I just submitted a PR to add amazon-cognito-auth-js definitions to DefinitelyTyped, see: DefinitelyTyped/DefinitelyTyped#25622

If interested, I can create a PR to add the same type definitions here for review and comment.

scottescue avatar May 08 '18 18:05 scottescue

Type definitions have been published to DefinitelyTyped and are now available through the @types/amazon-cognito-auth-js npm package. The DefinitelyTyped package should be deprecated once types are added here.

scottescue avatar May 10 '18 02:05 scottescue

hi all, I would like to ask your opinion about this fork I created where I made these changes:

  • javascript to typescript
  • Promises and userhandler functions
  • test with jest

There are small changes to make but your opinion is welcome so as to know if I can make a PR or publish it on npm.

Thanks

morrys avatar May 09 '19 20:05 morrys