mirror of https://github.com/vuejs/core.git
fix(types): allow falsy value types in `StyleValue` (#7954)
close #7955
This commit is contained in:
parent
d5fd343555
commit
17aa92b79b
|
@ -17,6 +17,33 @@ expectType<JSX.Element>(
|
||||||
<div style={[{ color: 'red' }, [{ fontSize: '1em' }]]} />
|
<div style={[{ color: 'red' }, [{ fontSize: '1em' }]]} />
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// #7955
|
||||||
|
expectType<JSX.Element>(
|
||||||
|
<div style={[undefined, '', null, false]} />
|
||||||
|
)
|
||||||
|
|
||||||
|
expectType<JSX.Element>(
|
||||||
|
<div style={undefined} />
|
||||||
|
)
|
||||||
|
|
||||||
|
expectType<JSX.Element>(
|
||||||
|
<div style={null} />
|
||||||
|
)
|
||||||
|
|
||||||
|
expectType<JSX.Element>(
|
||||||
|
<div style={''} />
|
||||||
|
)
|
||||||
|
|
||||||
|
expectType<JSX.Element>(
|
||||||
|
<div style={false} />
|
||||||
|
)
|
||||||
|
|
||||||
|
// @ts-expect-error
|
||||||
|
;<div style={[0]} />
|
||||||
|
|
||||||
|
// @ts-expect-error
|
||||||
|
;<div style={0} />
|
||||||
|
|
||||||
// @ts-expect-error unknown prop
|
// @ts-expect-error unknown prop
|
||||||
;<div foo="bar" />
|
;<div foo="bar" />
|
||||||
|
|
||||||
|
|
|
@ -244,7 +244,7 @@ interface AriaAttributes {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vue's style normalization supports nested arrays
|
// Vue's style normalization supports nested arrays
|
||||||
export type StyleValue = string | CSSProperties | Array<StyleValue>
|
export type StyleValue = false | null | undefined | string | CSSProperties | Array<StyleValue>
|
||||||
|
|
||||||
export interface HTMLAttributes extends AriaAttributes, EventHandlers<Events> {
|
export interface HTMLAttributes extends AriaAttributes, EventHandlers<Events> {
|
||||||
innerHTML?: string
|
innerHTML?: string
|
||||||
|
|
Loading…
Reference in New Issue