test(types): test for tsx style validation

This commit is contained in:
Evan You 2021-03-01 12:31:40 -05:00
parent 75fdcd85ce
commit 3f9906a2f8

View File

@ -12,6 +12,15 @@ expectType<JSX.Element>(<div />)
expectType<JSX.Element>(<div id="foo" />)
expectType<JSX.Element>(<input value="foo" />)
// @ts-expect-error style css property validation
expectError(<div style={{ unknown: 123 }} />)
// allow array styles and nested array styles
expectType<JSX.Element>(<div style={[{ color: 'red' }]} />)
expectType<JSX.Element>(
<div style={[{ color: 'red' }, [{ fontSize: '1em' }]]} />
)
// @ts-expect-error unknown prop
expectError(<div foo="bar" />)