/** * @jsx JSX * @flow */ // This one for when there are no JSX attributes declare function JSX< Children: $ReadOnlyArray, Elem, C: (props: {}, children: Children) => Elem >( component: C, props: null, ...children: Children ): Elem; // This one for when there are JSX attributes. declare function JSX< Children: $ReadOnlyArray, Elem, Props: Object, C: (props: Props, children: Children) => Elem >( component: C, props: Props, ...children: Children ): Elem; declare function AcceptsWhatever(props: {} | null, children: any): string; (: number); // Error string ~> number (Text: number); // Error string ~> number declare function ExpectsProps(props: { name: string }, children: any): string; (); // Error - missing prop (Text: number); // Error string ~> number declare function ExpectsChildrenTuple(props: any, children: [string]): string; (); // Error - mising child (Hi); // No error ({123}); // Error: number ~> string (Hi {"there"}); // Error: too many children declare function ExpectsChildrenArray(props: any, children: Array): string; (); // No error - 0 children is fine (Hi); // No error - 1 child is fine ({123}); // Error: number ~> string (Hi {"there"}); // No error - 2 children is fine