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 26, 2023
1 parent 27e1e38 commit a001a20
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/vue/jsx-runtime/dom.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,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 a001a20

Please sign in to comment.