Explorar o código

test(types): test for tsx style validation

Evan You %!s(int64=5) %!d(string=hai) anos
pai
achega
3f9906a2f8
Modificáronse 1 ficheiros con 9 adicións e 0 borrados
  1. 9 0
      test-dts/tsx.test-d.tsx

+ 9 - 0
test-dts/tsx.test-d.tsx

@@ -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" />)