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

Adds TypeScript Types #3

Merged
merged 3 commits into from
May 30, 2021
Merged

Adds TypeScript Types #3

merged 3 commits into from
May 30, 2021

Conversation

bozdoz
Copy link
Contributor

@bozdoz bozdoz commented May 28, 2021

Hey cool project! Just trying it out and noticed it didn't have any types. Seemed simple enough to add them, based on the types given in the README. ✌️

index.d.ts Outdated Show resolved Hide resolved
Comment on lines +9 to +13
interface AvatarComponent {
(props: AvatarProps, context?: any): React.ReactElement | null;
}

const Avatar: AvatarComponent
Copy link
Contributor

Choose a reason for hiding this comment

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

You could simplify this into:

Suggested change
interface AvatarComponent {
(props: AvatarProps, context?: any): React.ReactElement | null;
}
const Avatar: AvatarComponent
const Avatar: React.FunctionComponent<AvatarProps>;

That way it does not require the use of any 🎉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FunctionComponent adds children to props, but this library does not use the children prop. I copied the above from the React.FunctionComponent type and omitted what was unnecessary.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah yes, good point 👍

@janmonschke
Copy link
Contributor

Great idea! I came here to do the same and was happy to see your PR 🥳

Co-authored-by: Jan Monschke <janmonschke@fastmail.com>
@josepmartins
Copy link
Member

Thank you @bozdoz, looks good to me 👍.

@josepmartins josepmartins merged commit da19516 into boringdesigners:master May 30, 2021
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.

3 participants