amazon-archives / amazon-cognito-auth-js

The Amazon Cognito Auth SDK for JavaScript simplifies adding sign-up, sign-in with user profile functionality to web apps.
Apache License 2.0
424 stars 232 forks source link

Typing Issues related to amazon-cognito-auth-js #123

Open manueliglesias opened 6 years ago

manueliglesias commented 6 years ago

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 aws-sdk-typescript@0.0.3.

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

manueliglesias commented 6 years ago

Request: generate typescript type definitions

scottescue commented 6 years ago

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 commented 6 years ago

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.

morrys commented 5 years ago

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

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