Skip to content

Error TS7016: Could not find a declaration file for module 'vue-material' #530

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
diskman opened this issue Feb 17, 2017 · 9 comments
Closed

Comments

@diskman
Copy link

diskman commented Feb 17, 2017

Hi I try to use vue-material on project which use typescript. When I try to register plugin 'vue-material'

import 'es6-promise/auto'
import * as Vue from 'vue'
import  App from './App.vue'
import VueMaterial from 'vue-material'

Vue.use(VueMaterial)

// mount
new Vue({
  name: 'RootVue',
  el: '#app',
  render: h => h(App, {
    props: { propMessage: 'World' }
  })
})

the errors in shown

error TS7016: Could not find a declaration file for module 'vue-material'. 'C:\git\testing\webpack_simple\node_
modules\vue-material\dist\vue-material.js' implicitly has an 'any' type.

My tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "lib": [
      "dom",
      "es2015"
    ],
    "module": "commonjs",
    "moduleResolution": "node",
    "isolatedModules": false,
    "experimentalDecorators": true,
    "noImplicitAny": true,
    "noImplicitThis": true,
    "strictNullChecks": true,
    "removeComments": true,
    "suppressImplicitAnyIndexErrors": true,
    "typeRoots": [
        
    ]
  },
  "include": [
    "./src/**/*.ts"
  ],
  "compileOnSave": false
}
@diskman
Copy link
Author

diskman commented Feb 17, 2017

it seems that problem was because of "noImplicitAny": true, switching to false resolved problem

@dhruvdutt
Copy link

dhruvdutt commented Jun 2, 2017

@diskman Thanks a ton! You saved my day. 🍻

@JessicaInTime
Copy link

JessicaInTime commented Feb 28, 2018

Instead of setting noImplicitAny, I found that setting allowSyntheticDefaultImports to true allows vue-material to be imported correctly, i guess it's a case of vue-material bundle's export style? microsoft/TypeScript#10895

Seems i was mistaken? my build env fooled me

@Devnagri
Copy link

Thanks

@saisk73
Copy link

saisk73 commented Nov 23, 2019

it seems that problem was because of "noImplicitAny": true, switching to false resolved problem

thanks i was getting this error in production finally resolved...

@avfirsov
Copy link

avfirsov commented May 27, 2020

Hello guys! I am getting same error, when I just simply create new Vue project via vue-cli and follow official installation guideline. I am not using typescript and did not check to support TS while creating Vue project.

Switching "noImplicitAny": true to false did not help me (although I am not sure I changed it in the right place, since there are several tsconfig.json in my node_modules, I used located in vue-template-compiler).

What am I doing wrong?

@afaqahmedkhan
Copy link

Hello guys! I am getting same error, when I just simply create new Vue project via vue-cli and follow official installation guideline. I am not using typescript and did not check to support TS while creating Vue project.

Switching "noImplicitAny": true to false did not help me (although I am not sure I changed it in the right place, since there are several tsconfig.json in my node_modules, I used located in vue-template-compiler).

What am I doing wrong?

Were you able to resolve it? I think it was to be done in tsconfig of your root?

@jack-fleenor
Copy link

jack-fleenor commented Aug 11, 2021

Getting the same error, with the addition of md-field etc all throwing improperly registered component errors. I can't seem to locate the above solution (ctrl+shift+p for noImplicitAny gives no results) so I'm at a loss

{edit}
I just added the field directly to resolve the error in tsconfig.json

"allowJs": true,
"strict": true,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants