From 30d23be08ba5b5bf7152321d4cf05aba54db4d59 Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Sat, 23 Apr 2022 15:18:22 +0200 Subject: [PATCH] fix: typings using augmentation --- index.d.ts | 48 +++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/index.d.ts b/index.d.ts index a0ec01d4..9e0698c0 100644 --- a/index.d.ts +++ b/index.d.ts @@ -39,30 +39,32 @@ export interface ModalOptions extends Partial { props?: Record; } -// create a nativescript vue class that extends vue.js -export interface NativeScriptVue extends Vue { - nativeView: V +declare module 'vue/types/vue' { + // 3. Declare augmentation for Vue + interface Vue { + nativeView: V - $navigateTo: navigateTo - $navigateBack: navigateBack - - $modal?: { close: (data?: any) => Promise }; - - /** - * Open a modal using a component - * @param {typeof Vue} component - * @param {ModalOptions} options - * @returns {any} - */ - $showModal: (component: typeof Vue, options?: ModalOptions) => Promise; - - /** - * starts the nativescript application - */ - $start: () => void -} - -export interface NativeScriptVueConstructor extends VueConstructor + $navigateTo: navigateTo + $navigateBack: navigateBack + + $modal?: { close: (data?: any) => Promise }; + + /** + * Open a modal using a component + * @param {typeof Vue} component + * @param {ModalOptions} options + * @returns {any} + */ + $showModal: (component: typeof Vue, options?: ModalOptions) => Promise; + + /** + * starts the nativescript application + */ + $start: () => void + } + } +export interface NativeScriptVue extends Vue{}; +export interface NativeScriptVueConstructor extends VueConstructor> { navigateTo: navigateTo navigateBack: navigateBack