Translated to TypeScript and fixed issue with IAsyncComputedValue<T> #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
my original issue was that if I pass options to the
AsyncComputed
decorator function, theget
property of the passed options object supersedes the decorated function. Also, since theget
property of theIAsyncComputedValue<T>
interface is mandatory, I cannot circumvent this behavior by simply not specifying this property (at least when using a strict TypeScript configuration).I fixed this issue by implementing a second interface
IAsyncComputedOptions<TResult>
, which does not provide aget
property at all (because I think it does not make very much sense here). I am not really happy with this fix because it requires updating the new interface each time you modify theIAsyncComputedValue<T>
interface in the vue-async-computed package, but it was the best I could come up with.I also translated the project to TypeScript as requested here. I adjusted the configuration files as needed, but I have no clue about Travis CI, so you should check out, if that configuration needs to be modified as well.
Since my mother tongue is not English, I also hope that I have not made too many mistakes in the documentation comments 😁.
Cheers.