Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/typescript support #267

Merged
merged 8 commits into from
Mar 1, 2017
Merged

Conversation

mlaursen
Copy link
Owner

@mlaursen mlaursen commented Mar 1, 2017

#175

This will be the first pass-through of implementing typescript into react-md. In the future versions, this will hopefully be automated.

So this is my first guess at adding type definitions so it's probably wrong. Keeping it small and going to commit a component at a time.
Added what I think s the last for the typescript definitions. I just really need to test with another project to confirm.
badgeStyle?: React.CSSProperties;
badgeClassName?: string;
badgeId: string | number;
children: React.ReactNode;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know its suboptimal for fields which require children, but this should be optional: children?: React.ReactNode.

see: microsoft/TypeScript#6471

otherwise you have to do something like:

   <TableHeader children={null as any}>
        <TableRow children={null as any}>
            <TableColumn numeric>x</TableColumn>
            <TableColumn numeric>y</TableColumn>
        </TableRow>
    </TableHeader>

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops... I thought I fixed all of them after you mentioned that about the TableColumn. Thanks! The link and example definitely clears up why it is not ideal.

defaultStyle?: React.CSSProperties;
collapsed: boolean;
springConfig: Object;
children: React.ReactElement<any>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

swipeableViewsClassName?: string;
slideStyle?: React.CSSProperties;
slideClassName?: string;
children: React.ReactElement<Tabs>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interface TabsProps extends Props {
tabId: number | string;
component?: Function | string;
children: React.ReactElement<Tab> | Array<React.ReactElement<Tab>>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interface IconSeparatorProps extends Props {
labelStyle?: React.CSSProperties;
labelClassName?: string;
children: React.ReactNode;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

children: React.ReactElement<Tabs>,
component?: Function | string;
panelComponent?: Function | string;
headerComponent?: Function | string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can use Function for now, but at some point we should fill out the specific function type signature. I would say to leave as is and improve in a future PR.

Copy link
Contributor

@maxcan maxcan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@maxcan
Copy link
Contributor

maxcan commented Mar 1, 2017

but as i said, untested, it looks good though

@mlaursen
Copy link
Owner Author

mlaursen commented Mar 1, 2017

Yeah, thanks for your time! I'll hopefully release the next tag and documentation website update by end of day tomorrow. I haven't started writing the migration guide, so it might not be a plug-in-and-go type of thing. Going to keep validating things before the full release.

@mlaursen mlaursen merged commit 2a7bef0 into release/1.1.x Mar 1, 2017
@mlaursen mlaursen deleted the feature/Typescript-Support branch March 1, 2017 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants