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:
- In a typescript (3.1.2) project run:
./node_modules/.bin/tsc - See error
Expected behavior Successfully build
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 21
- Comments: 15 (3 by maintainers)
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.tsfile in mysrcdir with:Problem is here also. Iām trying to just use
withAuthenticatorin React and it crashes everythingI 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/cachehave alibfolder full of.d.tsfiles. 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.