From: Yuchao Date: Fri, 10 Nov 2023 06:23:54 +0000 (+1100) Subject: fix(types): allow falsy value types in `StyleValue` (#7954) X-Git-Tag: v3.3.9~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=17aa92b79b31d8bb8b5873ddc599420cb9806db8;p=thirdparty%2Fvuejs%2Fcore.git fix(types): allow falsy value types in `StyleValue` (#7954) close #7955 --- diff --git a/packages/dts-test/tsx.test-d.tsx b/packages/dts-test/tsx.test-d.tsx index 04915a9673..47555a03c0 100644 --- a/packages/dts-test/tsx.test-d.tsx +++ b/packages/dts-test/tsx.test-d.tsx @@ -17,6 +17,33 @@ expectType(
) +// #7955 +expectType( +
+) + +expectType( +
+) + +expectType( +
+) + +expectType( +
+) + +expectType( +
+) + +// @ts-expect-error +;
+ +// @ts-expect-error +;
+ // @ts-expect-error unknown prop ;
diff --git a/packages/runtime-dom/src/jsx.ts b/packages/runtime-dom/src/jsx.ts index 7769418653..3ab2de8b77 100644 --- a/packages/runtime-dom/src/jsx.ts +++ b/packages/runtime-dom/src/jsx.ts @@ -244,7 +244,7 @@ interface AriaAttributes { } // Vue's style normalization supports nested arrays -export type StyleValue = string | CSSProperties | Array +export type StyleValue = false | null | undefined | string | CSSProperties | Array export interface HTMLAttributes extends AriaAttributes, EventHandlers { innerHTML?: string