creotip / vue-particles

Vue.js component for particles backgrounds ✨
http://vue-particles.netlify.com/
1.44k stars 194 forks source link

Typescript #45

Closed Sodininkas closed 4 years ago

Sodininkas commented 5 years ago

How to run vue-particles with typescript?

yxbysxcoco commented 5 years ago

I find that they haven't @types/projecrt, so how can we use it with vue/typescript?

daviddesmet commented 5 years ago

You can use a quick workaround by creating a new file in your project's root directory:

// vue-particles.d.ts

declare module "vue-particles" {
  let VueParticles: any;
  export = VueParticles;
}
musicteachj commented 5 years ago

You can use a quick workaround by creating a new file in your project's root directory:

// vue-particles.d.ts

declare module "vue-particles" {
  let VueParticles: any;
  export = VueParticles;
}

@idaviddesmet Could you be a little more specific on your solution? I'm running into the same issue.

daviddesmet commented 5 years ago

@musicteachj sure! You create a new file named vue-particles.d.ts (or any other name, it must end with .d.ts) in your root directory (next to your package.json, tsconfig.json...) and that’s it. 😉

musicteachj commented 5 years ago

@idaviddesmet thank you for your response! It looks like I didn't need the .d.ts file after all (they must have updated the lib to not need it), it turns out I was missing the root tag with the id="app" attribute. I am using Vuetify, the installation deletes this tag when adding it to a Vue CLI creation.