Closed as not planned
Description
Bug Report
π Search Terms
jsx, infer property
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about JSX
β― Playground Link
import React from 'react'
declare function A(props: {
children:
| React.ReactElement<{ test: 'aaaa' | 'bbbb' }>
}): React.ReactElement
declare function B<P extends Record<string, any>>(props: ...
π» Code
import React from 'react'
declare function A(props: {
children:
| React.ReactElement<{ test: 'aaaa' | 'bbbb' }>
}): React.ReactElement
declare function B<P extends Record<string, any>>(props: P): React.ReactElement<P>
const C = <A>
<B test={'a'} />
// ^? (property) test: string
{B({
test: 'aaaa'
// ^? (property) test: 'aaaa'
})}
</A>
π Actual behavior
Infer test property is string
type in JSX.
π Expected behavior
Infer test property is 'aaaa'
type in JSX.