Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please remove dependency on vue-class-component for Typescript users... #464

Open
rfox12 opened this issue May 24, 2020 · 7 comments
Open
Labels
bug 🐛 Something isn't working question 🤔 Further information is requested released on @alpha

Comments

@rfox12
Copy link

rfox12 commented May 24, 2020

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 uses VueDecorator in exactly one line. Is there any easy way to separate that out?

@probil
Copy link
Owner

probil commented May 24, 2020

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?

@probil probil added bug 🐛 Something isn't working question 🤔 Further information is requested labels May 24, 2020
@rfox12
Copy link
Author

rfox12 commented May 25, 2020

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.

@rfox12
Copy link
Author

rfox12 commented May 25, 2020

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;

@probil
Copy link
Owner

probil commented May 25, 2020

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?

@ChrisAgar
Copy link

This is an issue for me as well. I installed the dependency as a workaround

@probil probil pinned this issue Jun 18, 2020
@guoxiangke
Copy link

same error

@probil
Copy link
Owner

probil commented Jan 25, 2021

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working question 🤔 Further information is requested released on @alpha
Projects
None yet
Development

No branches or pull requests

4 participants