Open rfox12 opened 4 years ago
Hi @rfox12 👋 Thanks for good words. I'm glad that library helps someone
Interesting claim I can tell you. 🤔 This is a bit strange because compiled library should not depend on vue-class-component
anyhow. If you don't import Socket
it should not bother you. But yeah, typescript sometimes is a bit "over-typed".
This is not the only issue I've got with the decorator. I had another problem with mixing default and named export which I thought was solved but it's not.
I guess it's time to move the decorator to a separate library. I think it will solve a bunch of problems. What do you think? I'm not sure just yet whether it's possible or not but I hope so ;)
BTW Are you using Vue 3 or just Composition API? Any ideas on how this library can benefit from composition API?
I'm using the Composition API as a plug-in for now (w/Vue 2.6). Vuex 4 just came out, but as far as I can tell you shouldn't really need to change anything with vue-socket.io-extended
. More Typescript will continue to come to Vue now. When Vuex 5 hits you'll probably need to change some things around to keep the library going. I'll let you know if I run into issues.
Maybe you could move these lines out of index.d.ts
and into a new socket.d.ts
file?
import { VueDecorator } from 'vue-class-component';
export const Socket: (eventName?: string) => VueDecorator;
I'm not sure whether typescript will start using that file socket.d.ts
automatically or not 🤔
I suppose if I import socket.d.ts
to index.d.ts
the problem won't disappear. They only solution I see is an experiment
@rfox12 if I make a branch with a potential fix would you like to check it?
This is an issue for me as well. I installed the dependency as a workaround
same error
@rfox12 fixed in alpha of v5, but requires vue 3 for now. Will try to adopt it to work with v2 + composition api plugin https://github.com/probil/vue-socket.io-extended/tree/alpha
I love this library--it's been useful. Now that all my projects are Typescript I've noticed that this library is complaining that I need
vue-class-component
... but I don't need it for my setup (I use the new Vue Composition API).It seems that
index.d.ts
usesVueDecorator
in exactly one line. Is there any easy way to separate that out?