From 2e6bbab038c002b44fb1f31418c94c8c596a889c Mon Sep 17 00:00:00 2001 From: webfansplz <308241863@qq.com> Date: Fri, 15 Jul 2022 16:39:19 +0800 Subject: [PATCH] fix(types): `Vue` default option type --- types/test/augmentation-test.ts | 1 + types/vue.d.ts | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/types/test/augmentation-test.ts b/types/test/augmentation-test.ts index 6e16585789..c11fddc809 100644 --- a/types/test/augmentation-test.ts +++ b/types/test/augmentation-test.ts @@ -41,6 +41,7 @@ const vm = new Vue({ vm.$instanceProperty vm.$instanceMethod() +vm.$root.$children[0].$children[0] Vue.staticProperty Vue.staticMethod() diff --git a/types/vue.d.ts b/types/vue.d.ts index b57c5016dd..796864e70c 100644 --- a/types/vue.d.ts +++ b/types/vue.d.ts @@ -38,18 +38,18 @@ export interface CreateElement { export interface Vue< Data = Record, Props = Record, - Parent = never, - Root = never, - Children = never, - Options = never, + Parent = unknown, + Root = unknown, + Children = unknown, + Options = unknown, Emit = (event: string, ...args: any[]) => Vue > { // properties with different types in defineComponent() readonly $data: Data readonly $props: Props - readonly $parent: Parent extends never ? Vue : Parent - readonly $root: Root extends never ? Vue : Root - readonly $children: Children extends never ? Vue[] : Children + readonly $parent: Parent extends unknown ? Vue : Parent + readonly $root: Root extends unknown ? Vue : Root + readonly $children: Children extends unknown ? Vue[] : Children readonly $options: ComponentOptions $emit: Emit