amplify-js: Could not find a declaration file for module '@aws-amplify/ui'

Describe the bug When trying to build a typescript project I’m getting: Could not find a declaration file for module ā€˜@aws-amplify/ui’:

node_modules/aws-amplify/lib/index.d.ts:8:16 - error TS7016: Could not find a declaration file for module '@aws-amplify/ui'. '/Users/samuelcastro/Projects/Control4/react-sdk/node_modules/@aws-amplify/ui/dist/aws-amplify-ui.js' implicitly has an 'any' type.
  Try `npm install @types/aws-amplify__ui` if it exists or add a new declaration (.d.ts) file containing `declare module '@aws-amplify/ui';`

8 import UI from '@aws-amplify/ui';

To Reproduce Steps to reproduce the behavior:

  1. In a typescript (3.1.2) project run: ./node_modules/.bin/tsc
  2. See error

Expected behavior Successfully build

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 21
  • Comments: 15 (3 by maintainers)

Most upvoted comments

This should not be marked as a feature request, it completely breaks compiling

I added "noImplicitAny": false, in my tsconfig.json and seems like the error is gone.

I solved by adding a types.d.ts file in my src dir with:

declare module "@aws-amplify/ui"; // amplify hack :(

Problem is here also. I’m trying to just use withAuthenticator in React and it crashes everything

I have this problem to with the latest version

Just stumbled upon this too. Everything else has a proper type declaration file in @aws-amplify. So this seems like just a tiny oversight. Other folders such as @aws-amplify/cache have a lib folder full of .d.ts files. But the UI folder does not.

Add "@aws-amplify/ui": "1.0.18", to package.json, below "aws-amplify": "1.1.26", and good luck 😃)

Yeah, an easy workaround would be just include it, I just wanted to see if a better solution is being take, like creating a typescript type definition of it.

Thanks anyway.