Can you provide an example for type checking JSX childrens?
Author: veeramarniCreated Aug 9, 2017Updated May 18, 2026
LabelsenhancementIssueHunt
https://github.com/Microsoft/TypeScript/issues/13618
Example: We create High-level component package with strong typed how the lower components designed to be.
type Avatar: () => JSX.Element;
interface ILoginProps {
accounts: object;
setFormType: Function;
children: Avatar;
}
class Login extends React.Component<ILoginProps, ILoginState> {
public static propTypes = {
Avatar: React.PropTypes.func,
}
public render(): JSX.Element {
const { Avatar } = this.props
return (<Avatar/>)
}
IssueHunt Summary
Backers (Total: $30.00)
Submitted pull Requests
Become a backer now!
Or submit a pull request to get the deposits!
Tips
- Checkout the Issuehunt explorer to discover more funded issues.
- Need some help from other developers? Add your repositories on IssueHunt to raise funds.
Source: piotrwitek/react-redux-typescript-guide