From 22cf8be060a8af27ab7c65abca5fe343a7e8f534 Mon Sep 17 00:00:00 2001 From: sceee Date: Wed, 4 Sep 2024 14:41:48 +0200 Subject: [PATCH] fix: global vue type augmentation (#6207) Augment vue types instead of 'vue/types/vue' and '@vue/runtime-core' to fix incompatibility with other libraries caused by the current augmentation behavior Fixes: #6199 Co-authored-by: sceee <11340487+sceee@users.noreply.github.com> --- packages/core/src/config/PrimeVue.d.ts | 10 +--------- .../src/confirmationservice/ConfirmationService.d.ts | 8 +------- packages/primevue/src/dialogservice/DialogService.d.ts | 8 +------- packages/primevue/src/toastservice/ToastService.d.ts | 8 +------- 4 files changed, 4 insertions(+), 30 deletions(-) diff --git a/packages/core/src/config/PrimeVue.d.ts b/packages/core/src/config/PrimeVue.d.ts index 33a2bc35c4..9e36adc869 100644 --- a/packages/core/src/config/PrimeVue.d.ts +++ b/packages/core/src/config/PrimeVue.d.ts @@ -161,15 +161,7 @@ export declare function usePrimeVue(): { declare const plugin: Plugin; export default plugin; -declare module 'vue/types/vue' { - interface Vue { - $primevue: { - config: PrimeVueConfiguration; - }; - } -} - -declare module '@vue/runtime-core' { +declare module 'vue' { interface ComponentCustomProperties { $primevue: { config: PrimeVueConfiguration; diff --git a/packages/primevue/src/confirmationservice/ConfirmationService.d.ts b/packages/primevue/src/confirmationservice/ConfirmationService.d.ts index 0e9f204e33..a2d4325e77 100644 --- a/packages/primevue/src/confirmationservice/ConfirmationService.d.ts +++ b/packages/primevue/src/confirmationservice/ConfirmationService.d.ts @@ -27,13 +27,7 @@ export interface ConfirmationServiceMethods { close(): void; } -declare module 'vue/types/vue' { - interface Vue { - $confirm: ConfirmationServiceMethods; - } -} - -declare module '@vue/runtime-core' { +declare module 'vue' { interface ComponentCustomProperties { $confirm: ConfirmationServiceMethods; } diff --git a/packages/primevue/src/dialogservice/DialogService.d.ts b/packages/primevue/src/dialogservice/DialogService.d.ts index 742bef7318..a8206e8df8 100644 --- a/packages/primevue/src/dialogservice/DialogService.d.ts +++ b/packages/primevue/src/dialogservice/DialogService.d.ts @@ -26,13 +26,7 @@ export interface DialogServiceMethods { open(content: any, options?: DynamicDialogOptions): DynamicDialogInstance; } -declare module 'vue/types/vue' { - interface Vue { - $dialog: DialogServiceMethods; - } -} - -declare module '@vue/runtime-core' { +declare module 'vue' { interface ComponentCustomProperties { $dialog: DialogServiceMethods; } diff --git a/packages/primevue/src/toastservice/ToastService.d.ts b/packages/primevue/src/toastservice/ToastService.d.ts index d6a3f974fb..9ab4d9a906 100755 --- a/packages/primevue/src/toastservice/ToastService.d.ts +++ b/packages/primevue/src/toastservice/ToastService.d.ts @@ -39,13 +39,7 @@ export interface ToastServiceMethods { removeAllGroups(): void; } -declare module 'vue/types/vue' { - interface Vue { - $toast: ToastServiceMethods; - } -} - -declare module '@vue/runtime-core' { +declare module 'vue' { interface ComponentCustomProperties { $toast: ToastServiceMethods; }