-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Use vue-axios to wrap axios into a plugin and provide TS typings #4479
Comments
@IlCallo If the axios option is selected, it would be a good option to generate the Instance property typing for the global vue instance property. I however do not agree with using the vue-typescript naming conventions for 2 reasons.
|
You meant https://github.com/imcvampire/vue-axios/blob/master/src/index.js |
Yes sorry, I did mean vue-axios... |
@IlCallo I can provide some guidance, but the challenge is that the shim should be part of the Typescript extension, but I'm not sure that the extension has access to the flag that indicates if axios was selected during the project creation. If Typescript was an option during initial project creation (planned), this would be much easier. Otherwise, it might be best (at least for now) to just document the proper way to add the shim for axios as part of the up coming Quasar Typescript documentation. |
We'll tackle this for the starter kit as we talked. |
Is your feature request related to a problem? Please describe.
Missing
axios
typings when using Quasar with Typescript.Describe the solution you'd like
vue-axios
wraps axios installation into a plugin and provides typings.axios boot file should change from
to
Instead of
$axios
, it would be available both onaxios
and$http
(I think it's for compatibility with Vue resources or something like that).(
Vue
typing asVueConstructor
is an addition I made, should be integrated when TS is added to the project probably)Describe alternatives you've considered
Manually defining types somewhere (into axios boot file?) for Vue instance and constructor like this
If done in this way,
$http
can be avoided and$axios
retained as is, avoiding breaking changes and an additional dependency.Even if, the dependency is so small you could actually add it into Quasar and wrap axios installation with plugin system (which is the preferred way, as I understood).
Useful link: official Vue guide to deal with global properties with Typescript
The text was updated successfully, but these errors were encountered: