question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Vue.js + TypeScript build error, `Could not find a declaration file for module '@aws-amplify/ui'`

See original GitHub issue

Vue.js + TypeScript + AWS Amplify, I encountered the following error. Could not find types file. Is this error default behavior ? Is there a way to avoid this error?

ERROR in /mypath/node_modules/aws-amplify/lib/index.d.ts
8:16 Could not find a declaration file for module '@aws-amplify/ui'. '/mypath/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';`
     6 | import Cache from '@aws-amplify/cache';
     7 | import Interactions, { InteractionsClass } from '@aws-amplify/interactions';
  >  8 | import UI from '@aws-amplify/ui';
       |                ^
     9 | import XR, { XRClass } from '@aws-amplify/xr';
    10 | import Amplify, { ConsoleLogger as Logger, Hub, JS, ClientDevice, Signer, I18n, ServiceWorker } from '@aws-amplify/core';
    11 | export default Amplify;
ERROR in /mypath/src/main.ts
9:31 Could not find a declaration file for module 'aws-amplify-vue'. '/mypath/node_modules/aws-amplify-vue/dist/aws-amplify-vue.common.js' implicitly has an 'any' type.
  Try `npm install @types/aws-amplify-vue` if it exists or add a new declaration (.d.ts) file containing `declare module 'aws-amplify-vue';`
     7 |
     8 | import Amplify, * as AmplifyModules from 'aws-amplify'
  >  9 | import { AmplifyPlugin } from 'aws-amplify-vue'
       |                               ^
    10 | import awsexports from './aws-exports'
    11 |
    12 | Vue.config.productionTip = false
ERROR in /mypath/src/router/index.ts
9:31 Could not find a declaration file for module 'aws-amplify-vue'. '/mypath/node_modules/aws-amplify-vue/dist/aws-amplify-vue.common.js' implicitly has an 'any' type.
  Try `npm install @types/aws-amplify-vue` if it exists or add a new declaration (.d.ts) file containing `declare module 'aws-amplify-vue';`
     7 |
     8 | import * as AmplifyModules from 'aws-amplify'
  >  9 | import { AmplifyPlugin } from 'aws-amplify-vue'
       |                               ^
    10 | import AmplifyStore from '@/store/index'
    11 |
    12 | Vue.use(Router)
ERROR in /mypath/src/views/Home.vue
23:25 Could not find a declaration file for module 'aws-amplify-vue/src/components/storage'. '/mypath/node_modules/aws-amplify-vue/src/components/storage/index.js' implicitly has an 'any' type.
  Try `npm install @types/aws-amplify-vue` if it exists or add a new declaration (.d.ts) file containing `declare module 'aws-amplify-vue/src/components/storage';`
    21 | // import { Component, Vue } from 'vue-property-decorator'
    22 | import { Auth, API, graphqlOperation, Storage } from 'aws-amplify'
  > 23 | import { S3Image } from 'aws-amplify-vue/src/components/storage'
       |                         ^
    24 | import router from '@/router'
    25 | import * as APITypes from '../API'
Version: typescript 3.4.5

tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "module": "esnext",
    "jsx": "preserve",
    "importHelpers": true,
    "moduleResolution": "node",
    "experimentalDecorators": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "allowJs": true,
    "strict": true,
    "sourceMap": true,
    "baseUrl": ".",
    "types": [
      "webpack-env",
      "jest",
      "node",
      "vuetify",
      "aws-amplify-vue"
    ],
    "paths": {
      "@/*": [
        "src/*"
      ]
    },
    "lib": [
      "esnext",
      "dom",
      "dom.iterable",
      "scripthost"
    ]
  },
  "include": [
    "src/**/*.ts",
    "src/**/*.tsx",
    "src/**/*.vue",
    "tests/**/*.ts",
    "tests/**/*.tsx"
  ],
  "exclude": [
    "node_modules"
  ]
}

package.json

  "dependencies": {
    "@aws-amplify/cli": "^1.7.2",
    "@aws-amplify/ui": "^1.0.19",
    "@types/graphql": "^14.2.0",
    "@types/zen-observable": "^0.8.0",
    "aws-amplify": "^1.1.28",
    "aws-amplify-vue": "^0.2.11",
    "core-js": "^2.6.5",
    "register-service-worker": "^1.6.2",
    "rxjs-compat": "^6.5.2",
    "vue": "^2.6.10",
    "vue-class-component": "^7.0.2",
    "vue-property-decorator": "^8.1.0",
    "vue-router": "^3.0.3",
    "vuetify": "^1.5.5",
    "vuex": "^3.0.1"
  },
  "devDependencies": {
    "@types/jest": "^23.1.4",
    "@types/node": "^12.0.3",
    "@vue/cli-plugin-babel": "^3.8.0",
    "@vue/cli-plugin-e2e-cypress": "^3.8.0",
    "@vue/cli-plugin-eslint": "^3.8.0",
    "@vue/cli-plugin-pwa": "^3.8.0",
    "@vue/cli-plugin-typescript": "^3.8.0",
    "@vue/cli-plugin-unit-jest": "^3.8.0",
    "@vue/cli-service": "^3.8.0",
    "@vue/eslint-config-standard": "^4.0.0",
    "@vue/eslint-config-typescript": "^4.0.0",
    "@vue/test-utils": "1.0.0-beta.29",
    "babel-core": "7.0.0-bridge.0",
    "babel-eslint": "^10.0.1",
    "eslint": "^5.16.0",
    "eslint-plugin-vue": "^5.0.0",
    "lint-staged": "^8.1.5",
    "sass": "^1.18.0",
    "sass-loader": "^7.1.0",
    "stylus": "^0.54.5",
    "stylus-loader": "^3.0.1",
    "ts-jest": "^23.0.0",
    "typescript": "3.4.5",
    "vue-cli-plugin-pug": "^1.0.7",
    "vue-cli-plugin-vuetify": "^0.5.0",
    "vue-template-compiler": "^2.6.10",
    "vuetify-loader": "^1.0.5"
  }

Information

Vue.js => 3.8.2 TypeScript => 3.4.5

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

24reactions
lakshmi-kannancommented, Jul 26, 2019

+1 to typing definitions.

0reactions
calebpollmancommented, Jun 21, 2022

For those currently watching this ticket, Amplify UI has released a new package for Vue components: @aws-amplify/ui-vue (additionally, aws-amplify-vue is no longer maintained).

You can find the package here and the documentation here, please let us know if it meets your needs!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Could not find a declaration file for module 'vue-xxx'
This error occured because of vue-xxxxxx has been generated in JavaScript. Method 1: To avoid the issue I just replace it by the...
Read more >
Could not find a declaration file for module - Vue Forum
Hello Experts, Every time I install third-party package using npm. And import it to my component. Get this error "Could not find a ......
Read more >
@aws-amplify/ui-vue - npm
Amplify UI is an open-source UI library with cloud-connected components that are endlessly customizable, accessible, and can integrate into any application.
Read more >
Project Setup - Create your application - JavaScript
Strictly typing aws-exports ... Could not find a declaration file for module './aws-exports'. 'aws-exports.js' implicitly has an 'any' type.
Read more >
Error TS7016: Could not find a declaration file for module ...
Working with typescript and Vue this error above kept popping up. Well the installation was as recommend in the Vue Typescript documentation ....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found