We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hey,
typescript version: 2.5.3
My problem is really close to this issue's, although the main problem of it was fixed: #10171 so I take this issue's example:
type TextProps = { editable: false } | { editable: true, onEdit: (newText: string) => void } class TextComponent extends React.Component<TextProps, {}> { render() { return <span>Some Text..</span>; } }
I can't use the props in JSX, while it works with directly using React.createElement:
React.createElement
const textProps: TextProps = { editable: true as true, // Whoops, why not literal type? onEdit: () => {} } as any; <TextComponent {...textProps} /> // fails React.createElement(Button, textProps) // works // or function id(t: TextProps): TextProps { return t; } const textProps2: TextProps = id(textProps); <TextComponent {...textProps2} />, // fails React.createElement(Button, textProps2) // works
Any clue why or how to fix/workaround that?
Thanks
The text was updated successfully, but these errors were encountered:
Duplicate of #18670
Sorry, something went wrong.
No branches or pull requests
Hey,
typescript version: 2.5.3
My problem is really close to this issue's, although the main problem of it was fixed:
#10171
so I take this issue's example:
I can't use the props in JSX, while it works with directly using
React.createElement
:Any clue why or how to fix/workaround that?
Thanks
The text was updated successfully, but these errors were encountered: