From 73807aeaf72ab102510f9a9dfa1dcc21c11bf23a Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 10 Jul 2020 18:04:44 -0400 Subject: [PATCH] types: fix jsx type collision with generated type after concatenation --- packages/runtime-dom/types/jsx.d.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/runtime-dom/types/jsx.d.ts b/packages/runtime-dom/types/jsx.d.ts index 77216de6..2c9daff2 100644 --- a/packages/runtime-dom/types/jsx.d.ts +++ b/packages/runtime-dom/types/jsx.d.ts @@ -1,8 +1,6 @@ // Note: this file is auto concatenated to the end of the bundled d.ts during // build. -import { Ref, ComponentPublicInstance } from '@vue/runtime-core' - // This code is based on react definition in DefinitelyTyped published under the MIT license. // Repository: https://github.com/DefinitelyTyped/DefinitelyTyped // Path in the repository: types/react/index.d.ts @@ -1307,9 +1305,16 @@ type EventHandlers = { [K in StringKeyOf]?: E[K] extends Function ? E[K] : (payload: E[K]) => void } +// use namespace import to avoid collision with generated types which use +// named imports. +import * as RuntimeCore from '@vue/runtime-core' + type ReservedProps = { key?: string | number - ref?: string | Ref | ((ref: Element | ComponentPublicInstance | null) => void) + ref?: + | string + | RuntimeCore.Ref + | ((ref: Element | RuntimeCore.ComponentInternalInstance | null) => void) } type ElementAttrs = T & EventHandlers & ReservedProps