kaorun343 / vue-property-decorator

Vue.js and Property Decorator
MIT License
5.52k stars 380 forks source link

noImplicitAny: Could not find a declaration file #57

Closed qm3ster closed 7 years ago

qm3ster commented 7 years ago

When importing, eg

import { Component, Prop, Vue } from 'vue-property-decorator'

with

"noImplicitAny": true

I get the following error:

[tsl] ERROR in /components/Board/Sum.vue.ts(8,38)
      TS7016: Could not find a declaration file for module 'vue-property-decorator'. '/node_modules/vue-property-decorator/lib/vue-property-decorat
or.umd.js' implicitly has an 'any' type.
  Try `npm install @types/vue-property-decorator` if it exists or add a new declaration (.d.ts
) file containing `declare module 'vue-property-decorator';`

On the other hand, clicking on the module name in VSCode takes me to lib/vue-property-decorator.d.ts

And everything works correctly with noImplicitAny: false

Finally, allowSyntheticDefaultImports has no effect, although vuejs/vue-class-component#usage claims that it needs to be true

kaorun343 commented 7 years ago

@qm3ster

Sorry for late reply...

Is this problem still unsolved yet?

qm3ster commented 7 years ago

Maybe I had a low Vue version. I will reopen this if it happens again, I am on a very different setup now.

bb commented 6 years ago

I had something very similar with import { uniq, sortBy } from 'lodash'; and the hint with noImplicitAny helped for me. Thanks!

But as I am not using Vue at all in that project, it looks to me like Vue is not related to this issue. Btw, I had similar issues with other modules not being found (at all), e.g. mobx-react. Which were also solved this way.

Subscribing to this just in case someone finds out the real reason.