vue-axios icon indicating copy to clipboard operation
vue-axios copied to clipboard

Migrate to Typescript

Open imcvampire opened this issue 4 years ago • 6 comments

Convert the current code to Typescript could help to solve some problems with type definition

imcvampire avatar Sep 30 '21 21:09 imcvampire

👋 I'd be happy to help with this. I'm curious about what kind of type problems you have currently?

callmehiphop avatar Oct 08 '21 08:10 callmehiphop

@callmehiphop This package has some problem with typing on TS: it isn't correct and enough for some people.

imcvampire avatar Oct 08 '21 14:10 imcvampire

So I've been having a go at this today. I think I understand the issues now - I'm not sure its possible to support both version 2 and version 3 in the same package since it involves augmenting 2 modules where 1 of them is most certainly going to be absent. Seems like we want to export these separately. Thoughts on that?

callmehiphop avatar Oct 09 '21 20:10 callmehiphop

So as I understand, it means we will have a breaking change because of 2 different entry points?

imcvampire avatar Oct 10 '21 15:10 imcvampire

I'm unclear on the OP, but this might be similar to the issue I was going to raise. Are you saying you are not getting type safety and IntelliSense? That is certainly true here: const axios: any = inject('axios') // inject axios

... and VS Code is not going to be helpful in using axios at all, no IntelliSense. I was looking at a solution like using InjectionKey: https://logaretm.com/blog/2020-12-23-type-safe-provide-inject

dapug avatar Oct 24 '21 03:10 dapug

@dapug I think your problem is related too. As I am not an expert on both TS and Vue3, I just raise it here to get some helps/suggestions on resolving all TS-related problems.

imcvampire avatar Oct 25 '21 08:10 imcvampire