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

Suggestion for type improvement #162

Open
Arasid opened this issue Sep 26, 2019 · 0 comments
Open

Suggestion for type improvement #162

Arasid opened this issue Sep 26, 2019 · 0 comments

Comments

@Arasid
Copy link

Arasid commented Sep 26, 2019

Hi, I would like to suggest changing types to something similar as:

export interface InputRangeProps<T extends Range | number> {
  ...
  onChange: (value: T) => void;
  onChangeStart?: (value: T) => void;
  onChangeComplete?: (value: T) => void;
  value: T;
}

export default class InputRange<T extends Range | number> extends React.Component<InputRangeProps<T>, any> {}

It would be a great help. e.g. when implementing onChange method, where typescript forces me to write code for both number and range case, even though based on value, the other case will never happen ...

Thank you for this project!

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

No branches or pull requests

1 participant