The original issue is issue #10171. Currently we don't treat property assignment of JSX element as literal type as issue #10171 illustrates
type TextProps = { editable: false }
| { editable: true, onEdit: (newText: string) => void }
class TextComponent extends React.Component<TextProps, {}> {
render() {
return <span>Some Text..</span>;
}
}
ReactDOM.render(
<TextComponent editable={true} />, // editable is of type boolean not of type "true"
document.getElementById("example")
);
One possible solution is to treat property as literal type instead. This could possibly affect how overload will work as well
The original issue is issue #10171. Currently we don't treat property assignment of JSX element as literal type as issue #10171 illustrates
One possible solution is to treat property as literal type instead. This could possibly affect how overload will work as well