Can you provide an example for type checking JSX childrens?

Author: veeramarniCreated Aug 9, 2017Updated May 18, 2026
LabelsenhancementIssueHunt

Issuehunt badges

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

Source: piotrwitek/react-redux-typescript-guide