Reputation: 113
I want to use vue-simple-spinner in my project, but when I import it I get the following error:
Could not find a declaration file for module 'vue-simple-spinner'.
'c:/Users/Korisnik/Desktop/projects/typescript-chord-app/node_modules/vue-
simple-spinner/dist/vue-simple-spinner.js' implicitly has an 'any' type.
Try `npm install @types/vue-simple-spinner` if it exists or add a new
declaration (.d.ts) file containing `declare module 'vue-simple-spinner';`
I created shims-spinner.d.ts
file:
declare module 'vue-simple-spinner' {
import Spinner from 'vue-simple-spinner';
export default Spinner;
}
but then I get Circular definition of import alias 'Spinner'
.
How can I fix this?
Upvotes: 0
Views: 1192
Reputation: 6788
In order to import and render the Spinner
module, you should be able to do so by placing:
declare module 'vue-simple-spinner' {
const spinner: any;
export default spinner;
}
In your shims.d.ts
.
If you want to use a more complex type (which I don't think has any use in this case, since you're only importing the Spinner to render it in html) you can replace the any
typing with anything that makes sense.
Upvotes: 2