From c16f1c8a4d2a1742478456eaa355f28c2b9cbc71 Mon Sep 17 00:00:00 2001 From: WORMSS Date: Mon, 17 Feb 2020 08:31:08 +0000 Subject: [PATCH] Update vue.d.ts Added undefined as a return type of $refs as it was quite hard to convince typescript that something COULD be undefined if you type in a ref that doesn't exist, I also changed the two array statements from `Element[] | Vue[]` to `(Element | Vue)[]` because it's not guaranteed that they are ALL Elements or they are ALL Vue components. (Very likely, yes, but not always) For example ```html ``` --- types/vue.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/vue.d.ts b/types/vue.d.ts index 204f9cca94d..dcd9be1dca1 100644 --- a/types/vue.d.ts +++ b/types/vue.d.ts @@ -26,7 +26,7 @@ export interface Vue { readonly $parent: Vue; readonly $root: Vue; readonly $children: Vue[]; - readonly $refs: { [key: string]: Vue | Element | Vue[] | Element[] }; + readonly $refs: { [key: string]: Vue | Element | (Vue | Element)[] | undefined }; readonly $slots: { [key: string]: VNode[] | undefined }; readonly $scopedSlots: { [key: string]: NormalizedScopedSlot | undefined }; readonly $isServer: boolean;