Skip to content

Commit 21690e4

Browse files
committed
fix(type): Allow undefined in StyleValue Array
close #7954
1 parent cbc2733 commit 21690e4

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

packages/dts-test/tsx.test-d.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ expectType<JSX.Element>(<div style={[{ color: 'red' }]} />)
1515
expectType<JSX.Element>(
1616
<div style={[{ color: 'red' }, [{ fontSize: '1em' }]]} />
1717
)
18+
expectType<JSX.Element>(
19+
<div style={[undefined, {background: 'green'}]} />
20+
)
1821

1922
// @ts-expect-error unknown prop
2023
;<div foo="bar" />
@@ -58,3 +61,4 @@ expectType<JSX.Element>(
5861
)
5962
// @ts-expect-error
6063
;<Suspense onResolve={123} />
64+

packages/runtime-dom/types/jsx.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ interface AriaAttributes {
235235
}
236236

237237
// Vue's style normalization supports nested arrays
238-
export type StyleValue = string | CSSProperties | Array<StyleValue>
238+
export type StyleValue = undefined | string | CSSProperties | Array<StyleValue>
239239

240240
export interface HTMLAttributes extends AriaAttributes, EventHandlers<Events> {
241241
innerHTML?: string

0 commit comments

Comments
 (0)