Skip to content

Commit

Permalink
fix(type): Allow undefined in StyleValue Array
Browse files Browse the repository at this point in the history
close #7954
  • Loading branch information
yuwu9145 committed Mar 25, 2023
1 parent cbc2733 commit 21690e4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/dts-test/tsx.test-d.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ expectType<JSX.Element>(<div style={[{ color: 'red' }]} />)
expectType<JSX.Element>(
<div style={[{ color: 'red' }, [{ fontSize: '1em' }]]} />
)
expectType<JSX.Element>(
<div style={[undefined, {background: 'green'}]} />
)

// @ts-expect-error unknown prop
;<div foo="bar" />
Expand Down Expand Up @@ -58,3 +61,4 @@ expectType<JSX.Element>(
)
// @ts-expect-error
;<Suspense onResolve={123} />

2 changes: 1 addition & 1 deletion packages/runtime-dom/types/jsx.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ interface AriaAttributes {
}

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

export interface HTMLAttributes extends AriaAttributes, EventHandlers<Events> {
innerHTML?: string
Expand Down

0 comments on commit 21690e4

Please sign in to comment.