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 a791dd3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 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
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 a791dd3

Please sign in to comment.