foxbenjaminfox/vue-async-computed

TypeScript support in 3.8.0

nwtgck opened this issue · 4 comments

Hi, @foxbenjaminfox! Thank you very much for support TypeScript officially.

I just tried vue-async-computed@3.8.0 in TypeScript. Could you tell me how to import AsyncComputed ? I tried several ways to import it, but not successful.

And, I found published vue-async-computed@3.8.0 in my node_modules has no types/ directory. Is this OK?
image

Thanks for pointing that out. It seems that I made a mistake, and forgot to add the types directory to the list of published directories in v3.8.0. I've released a v3.8.1 release which fixes this.

Please let me know if it works for you properly now.

@foxbenjaminfox Thank you very much. It seems the type definition problem was fixed.

I'm not sure the correct usage in TypeScript. I imported like the following.
import AsyncComputed from "vue-async-computed";
, and I have the error below. I found AsyncComputed is a class. It is not a decorator any more? In #25 it was a decorator. I could not find a document to know how to use vue-async-computed in TypeScript. So, could you tell me how to use vue-async-computed in TypeScript?

I could use 3.8.1 in my project: https://github.com/nwtgck/piping-ui-web/pull/131/files.


(added)
Is there any plan to support a decorator for TypeScript? If not, could you export interface IAsyncComputedValue<T>? It will help me to create a decorator without duplicate type-definitions.

I'm glad that v3.8.1 now works for you. I could definitely export the IAsyncComputedValue interface if you want to use it to write a decorator, but I'll actually do you one better: if you'd like to open a PR with your decorator, I'd be happy to merge it. That way everyone else can also benefit from the decorator as well.

All in all, I'm happy to take contributions to this or indeed to any part of vue-async-computed, but it is rather unlikely that I'll end up adding anything typescript-related myself.

@foxbenjaminfox Thanks! I made #88.