Amplify-js: Could not find a declaration file for module 'amazon-cognito-auth-js'

Created on 12 May 2018  路  5Comments  路  Source: aws-amplify/amplify-js

Bug report

What is the current behavior?

On the latest version of the Amplify library, when using Typescript, the project will fail to compile with the following:

~/Projects/react-starter/node_modules/aws-amplify/lib/Common/Facet.d.ts
(6,34): Could not find a declaration file for module 'amazon-cognito-auth-js'. '/Projects/react-starter/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';`

What is the expected behavior?

A user should be able to successfully import the library without having to create a declaration file manually.

Which versions of Amplify, and which browser / OS are affected by this issue? Did this work in previous versions?

v0.3.0 does not have this issue.

Cognito feature-request

Most helpful comment

"noImplicitAny: false" does the trick but I agree with @hassankhan, this should be treated like a bug.

All 5 comments

@hassankhan the amazon-cognito-auth-js module currently doesn't support typescript. We will mark this as a feature request.

Not sure if it should be just a feature request, this actively breaks the library for any Typescript users updating.

@hassankhan could you try to turn off noImplicitAny to bypass this warning for now? https://github.com/Microsoft/TypeScript/issues/15031

"noImplicitAny: false" does the trick but I agree with @hassankhan, this should be treated like a bug.

Closing since the package doesn't seem to be a dependency of this project any more.

Was this page helpful?
0 / 5 - 0 ratings