Skip to content

Conversation

@fraparisi
Copy link
Contributor

Without the install function typescript get an error like this:
Argument of type 'typeof InfiniteLoading' is not assignable to parameter of type 'PluginObject<{ props: { spinner: string; }; system: { throttleLimit: number; }; }> | PluginFunction<{ props: { spinner: string; }; system: { throttleLimit: number; }; }>'.   Property 'install' is missing in type 'typeof InfiniteLoading' but required in type 'PluginObject<{ props: { spinner: string; }; system: { throttleLimit: number; }; }>'.

@codecov
Copy link

codecov bot commented Jan 3, 2019

Codecov Report

Merging #214 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@ Coverage Diff @@ ## master #214 +/- ## ===================================== Coverage 100% 100% ===================================== Files 5 5 Lines 173 173 Branches 32 32 ===================================== Hits 173 173

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d79ea27...a6495a9. Read the comment docs.

@PeachScript
Copy link
Owner

PeachScript commented Jan 7, 2019

Hi @fraparisi, thanks for your PR, but I have a question, the install method just use to register this plugin on Vue via Vue.use method, what is the situation we need to use it directly?

@fraparisi
Copy link
Contributor Author

I'm not sure if I understand correctly but I see that is possible to use this component as a Plugin https://peachscript.github.io/vue-infinite-loading/guide/configure-plugin-opts.html#props-settings.
From the documentation of vue to make a plugin you need an install function https://vuejs.org/v2/guide/plugins.html#Writing-a-Plugin that is need to make it work as a plugin.
In the types definitions of vuejs, Vue.use need an install function of type PluginFunction.
I hope this was the right answer for your question :)

@PeachScript
Copy link
Owner

Thanks for your explanation, sorry I didn't make it clear, my question is why we need to declare the install method because we never use it directly, it just create for the Vue plugin API. I guess your meaning is, it is the official best practice, is that right?

@fraparisi
Copy link
Contributor Author

Yes correct.

@PeachScript
Copy link
Owner

That's great! But did you forgot to import PluginFunction from vue?

@fraparisi
Copy link
Contributor Author

yes, sorry. Imported now :)

@PeachScript PeachScript merged commit 8748ad4 into PeachScript:master Jan 19, 2019
@StevenDevooght
Copy link

Hi,

We are facing the same issue. Any plans to make a release for this fix?

@PeachScript
Copy link
Owner

Hi @StevenDevooght , sorry for late, the v2.4.4 has been released, contains this change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants