Closed
Description
TypeScript Version: 2.9.2. strict: true
Search Terms:
jsx discriminant unions, jsx unions
Following code works as expected, but intellisense won't work for additional union attributes ( foo
/ bar
) although if attribute is provided manually, intellisense works as expected (foo
->blah OR wat
)
Code
import React, { Component } from 'react'
type Props =
| {
type: 'foo'
foo: 'blah' | 'wat'
}
| {
type: 'bar'
bar: string
}
class Test extends Component<Props> {
render() {
return null
}
}
const App = () => (
<>
{/* missing `foo` attribute intellisene, but works for literal values */}
<Test type="foo" />;
{/* missing `bar` attribute intellisene */}
<Test type="bar" />
</>
)
Expected behavior:
provide intellisense for supported union attributes
Actual behavior: