You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Any package using the augmentation of '@vue/runtime-core' will break and override other packages.
The solution:
Change the module-declaration from '@vue/runtime-core' to 'vue'.
Reproduction
Create a vue-project with typescript support and install the auth0-vue package.
create a new 'global-types.d.ts' file with the following content:
declare module 'vue'{exportinterfaceComponentCustomProperties{/** * A custom property. */$myCustomProperty:'Hi there'}}
Include the 'global-types.d.ts' file in your ts-config.
Try to use the $myCustomProperty property directly in a template-block in any vue files. (the property should not show up and the editor should give you a type-error).
Change from '@vue/runtime-core' to 'vue' in the auth0-vue package: Navigate to node_module/@auth0/auth0-vue/dist/typings/index.d.ts
Go back to the vue-file and see that the property is correctly typed and no type-errors should be shown. Additionally, other properties like $router, $route etc should also work.
Note: you must also add the property to your vue-instance in order for it to work when compiled:
app.config.globalProperties.$myCustomProperty = 'Hi there'.
Additional context
If any other packages is using '@vue/runtime-core' to augment global property typings it will break the global property augmentation resulting in type-errors.
auth0-vue version
2.3.3
Vue version
3.5.11
Which browsers have you tested in?
Chrome
The text was updated successfully, but these errors were encountered:
I see that this was merged into main, but will there be a new version on npm for this package to fix the issues in my repos? I don't quite understand the process of how this package is maintained and by who so sorry in advance if I'm missing something obvious.
Thanks for the reply, I didn't get this to work in my pnpm monorepo/pipeline. It's not a big issue though, but hopefully this will be published on npm soon enough :)
Checklist
Description
In newer vue versions the global properties augmentation has changed from using '@vue/runtime-core' to 'vue'.
The incorrect global property augmentation:
The correct global propery augmentation:
It is described in the vue documentation here: https://vuejs.org/guide/typescript/options-api#augmenting-global-properties
Any package using the augmentation of '@vue/runtime-core' will break and override other packages.
The solution:
Change the module-declaration from '@vue/runtime-core' to 'vue'.
Reproduction
Note: you must also add the property to your vue-instance in order for it to work when compiled:
app.config.globalProperties.$myCustomProperty = 'Hi there'.
Additional context
If any other packages is using '@vue/runtime-core' to augment global property typings it will break the global property augmentation resulting in type-errors.
auth0-vue version
2.3.3
Vue version
3.5.11
Which browsers have you tested in?
Chrome
The text was updated successfully, but these errors were encountered: