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

Components: extend react types to reduce repetition #3548

Merged
merged 5 commits into from
Feb 24, 2020

Conversation

siddharthkp
Copy link
Contributor

@siddharthkp siddharthkp commented Feb 19, 2020

We repeat a lot of types in the component to make typescript happy. This is a better way, we dont have to repeat ourselves.

- interface ISelectProps {
+ type SelectProps = 
+   React.SelectHTMLAttributes<HTMLSelectElement> &
+   React.SelectHTMLAttributes<HTMLInputElement> & {
      icon?: any;
      placeholder?: string;
      variant?: 'default' | 'link';
-     children?: any;
-     disabled?: boolean;
-     onChange?: any;
-     value?: string | number;
-     defaultValue?: string | number;
}

@lbogdan
Copy link
Contributor

lbogdan commented Feb 19, 2020

Build for latest commit 3592c49 is at https://pr3548.build.csb.dev/s/new.

@CompuIves
Copy link
Member

Very nice work!!! I was looking for exactly this in my PR.

@SaraVieira SaraVieira merged commit db8244e into master Feb 24, 2020
@SaraVieira SaraVieira deleted the less-redundant-types branch February 24, 2020 10: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.

5 participants