// @jsx: preserve // @filename: index.tsx namespace JSX { export interface Element {} } type Props = PropsBase | PropsWithConvert; interface PropsBase { data: T; } interface PropsWithConvert extends PropsBase { convert: (t: T) => string; } function ShouldInferFromData(props: Props): JSX.Element { return
; } // Sanity check: function call equivalent versions work fine ShouldInferFromData({ data: "1" }); ShouldInferFromData({ data: "1", convert: n => "" + n }); ShouldInferFromData({ data: 2, convert: n => "" + n }); const f1 = ; const f2 = "" + n} />; const f3 = "" + n} />;