From e030cf1a8604da089aa5d5c390ab58ffb6743775 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=B6=E8=BF=9C=E6=96=B9?= Date: Wed, 27 Sep 2023 10:07:47 +0800 Subject: [PATCH] types(runtime-dom): add `xmlns:xlink` to `SVGAttributes` --- packages/dts-test/tsx.test-d.tsx | 8 ++++++++ packages/runtime-dom/src/jsx.ts | 1 + packages/shared/src/domAttrConfig.ts | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/dts-test/tsx.test-d.tsx b/packages/dts-test/tsx.test-d.tsx index 04915a9673f..7f8756a2f75 100644 --- a/packages/dts-test/tsx.test-d.tsx +++ b/packages/dts-test/tsx.test-d.tsx @@ -59,3 +59,11 @@ expectType( ) // @ts-expect-error ; + +// svg +expectType( + +) diff --git a/packages/runtime-dom/src/jsx.ts b/packages/runtime-dom/src/jsx.ts index d3c0332c7c3..83a340defcb 100644 --- a/packages/runtime-dom/src/jsx.ts +++ b/packages/runtime-dom/src/jsx.ts @@ -1039,6 +1039,7 @@ export interface SVGAttributes extends AriaAttributes, EventHandlers { xlinkTitle?: string xlinkType?: string xmlns?: string + 'xmlns:xlink'?: string y1?: Numberish y2?: Numberish y?: Numberish diff --git a/packages/shared/src/domAttrConfig.ts b/packages/shared/src/domAttrConfig.ts index 5f7f851b0df..9a0f88b94de 100644 --- a/packages/shared/src/domAttrConfig.ts +++ b/packages/shared/src/domAttrConfig.ts @@ -118,6 +118,6 @@ export const isKnownSvgAttr = /*#__PURE__*/ makeMap( `v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,` + `vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,` + `writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,` + - `xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,` + + `xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,` + `xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan` )