posva / vuexfire

Check
https://github.com/vuejs/vuefire
MIT License
558 stars 49 forks source link

2.3.0 warning : Error when importing untyped JS modules #182

Closed ghost closed 6 years ago

ghost commented 6 years ago

in my store/root.js , I have

`import { firebaseMutations } from 'vuexfire'`

which raises the following warning

`   [ts]
Could not find a declaration file for module 'vuexfire'. '/Users/yves/Developments/WIP/VUE.JS-vcli-3-beta/le-choro-des-charentes/node_modules/vuexfire/dist/vuexfire.common.js' implicitly has an 'any' type.
  Try `npm install @types/vuexfire` if it exists or add a new declaration (.d.ts) file containing `declare module 'vuexfire';`
[ts]
Could not find a declaration file for module 'vuexfire'. '/Users/yves/Developments/WIP/VUE.JS-vcli-3-beta/le-choro-des-charentes/node_modules/vuexfire/dist/vuexfire.common.js' implicitly has an 'any' type.
  Try `npm install @types/vuexfire` if it exists or add a new declaration`

but @types/vuexfire does not exist ...

ghost commented 6 years ago

I got a solution

If you're importing a third-party module 'foo' that doesn't provide any typings, either in the library itself, or in the @types/foo package (generated from the DefinitelyTyped repository), then you can make this error go away by declaring the module in a .d.ts file:

  // foo.d.ts
  declare module 'foo';