merceyz / typescript-to-proptypes

Generate proptypes from typescript declarations
MIT License
53 stars 21 forks source link

feat: consider squashed call signatures of function components #20

Closed eps1lon closed 4 years ago

eps1lon commented 4 years ago

input:

interface Component {
    (props: ButtonProps): JSX.Element;
    (props: { component: React.ElementType } & ButtonProps): JSX.Element;
}

output:

ButtonBase.propTypes = {
    component: PropTypes.elementType,
    variant: PropTypes.string,
};

TODO:

eps1lon commented 4 years ago

@merceyz Anything wrong with this approach?

merceyz commented 4 years ago

@eps1lon First off, thanks for the PRs, really appreciate it :+1:. I haven't had the time to properly review this yet, just merged in master to get the tests to run on PRs again. I'll take a look as soon as I have time.

merceyz commented 4 years ago

Released as typescript-to-proptypes@2.0.0