Skip to content

TypeScript support in 3.8.0 #87

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

Closed
nwtgck opened this issue Dec 24, 2019 · 4 comments
Closed

TypeScript support in 3.8.0 #87

nwtgck opened this issue Dec 24, 2019 · 4 comments

Comments

@nwtgck
Copy link
Contributor

nwtgck commented Dec 24, 2019

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

I just tried [email protected] in TypeScript. Could you tell me how to import AsyncComputed ? I tried several ways to import it, but not successful.

And, I found published [email protected] in my node_modules has no types/ directory. Is this OK?
image

@nwtgck nwtgck mentioned this issue Dec 24, 2019
@foxbenjaminfox
Copy link
Owner

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.

@nwtgck
Copy link
Contributor Author

nwtgck commented Dec 24, 2019

@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.

@foxbenjaminfox
Copy link
Owner

foxbenjaminfox commented Dec 26, 2019

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.

@nwtgck
Copy link
Contributor Author

nwtgck commented Dec 26, 2019

@foxbenjaminfox Thanks! I made #88.

@nwtgck nwtgck closed this as completed Dec 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants