Hi, great work with Flowgen!
I tried to convert some React component definitions yesterday that has JSX.Element types. I think proper way to handle these types is to transform them to React$Node or React.Node automatically instead of global$JSX$Element. I think it's safe assumption in Flow since Flow assumes all the JSX to be React anyways, which means only JSX you can have in Flow codebase is React. Where this kind of logic would belong in the code base if I would want to give it a try?
Here is an example input and output of current behaviour:
Input:
/// <reference types="react" />
import * as React from 'react';
declare class Button extends React.PureComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & {
active?: boolean;
children?: string | JSX.Element;
fullWidth?: boolean;
icon?: JSX.Element;
small?: boolean;
large?: boolean;
primary?: boolean;
secondary?: boolean;
destructive?: boolean;
linkDefault?: boolean;
link?: boolean;
loading?: boolean;
}> {
render(): JSX.Element;
}
export default Button;
Output:
import * as React from "react";
declare class Button
mixins React.PureComponent<
React.ButtonHTMLAttributes<HTMLButtonElement> & {
active?: boolean,
children?: string | global$JSX$Element,
fullWidth?: boolean,
icon?: global$JSX$Element,
small?: boolean,
large?: boolean,
primary?: boolean,
secondary?: boolean,
destructive?: boolean,
linkDefault?: boolean,
link?: boolean,
loading?: boolean
}
>
render(): global$JSX$Element;
}
declare export default typeof Button;
Hi, great work with Flowgen!
I tried to convert some React component definitions yesterday that has
JSX.Elementtypes. I think proper way to handle these types is to transform them to React$Node or React.Node automatically instead of global$JSX$Element. I think it's safe assumption in Flow since Flow assumes all the JSX to be React anyways, which means only JSX you can have in Flow codebase is React. Where this kind of logic would belong in the code base if I would want to give it a try?Here is an example input and output of current behaviour:
Input:
Output: