shrpne / vue-inline-svg

Dynamically loads an SVG source and inline <svg> element so you can manipulate the style of it
MIT License
177 stars 22 forks source link

are there Typescript types? #28

Closed swiknaba closed 3 years ago

swiknaba commented 3 years ago

thanks for the library!

Are there any plans on adding type definitions? Possibly, some progress is already made?

Need help with that? 🙂

shrpne commented 3 years ago

Hi! I'm not experienced with Typescript, so I'm not sure that I'm able to maintain types.

If you want to add types and maintain them, I don't mind. Help is always welcome :)

eddie-englund commented 3 years ago

This would be awesome!

Because vue3 with Ts cast's errors like these:

Could not find a declaration file for module 'vue-inline-svg'. 'C:/Users/Titus/code/portfolio/app/node_modules/vue-inline-svg/dist/vue-inline-svg.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/vue-inline-svg` if it exists or add a new declaration (.d.ts) file containing `declare module 'vue-inline-svg';`

Also, you can use https://github.com/Microsoft/dts-gen to generate the d.ts

eddie-englund commented 3 years ago

Just made a PR, for such a generated file :)

Whenever you make changes to the props, just install this NPM package globally, then run the below command in the code root directory:

dts-gen -m vue-inline-svg
eddie-englund commented 3 years ago

Actually, I tested it locally and had some issues, I'll work more on this tomorrow and hopefully I'll get a working types file for this project 👍

shrpne commented 3 years ago

Please review #32 It is my attempt to add types, If it's ok, I will merge it

vincerubinetti commented 3 years ago

Update on this? Would be nice to get this integrated :)

vincerubinetti commented 3 years ago

For what it's worth, I tested out the PR and it seems to work. Though, I am not very experienced with typescript, and I also had to change VueConstructor to VueElementConstructor because I am using Vue 3 (no idea if that is actually the proper type/class, but it made the typescript errors go away 🤷 ).

shrpne commented 3 years ago

@vincerubinetti thank you, i will try to handle it soon

shrpne commented 3 years ago

Types added in aeacd342ba7f616e783247875c32b59183e2018a for vue3, published under v3.1.0

And 32b306ae49adb9e3483a4425ccc3362ce084d7f2 for vue2, published under v2.1.0