-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
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
[Select] onChange event Typescript typing is incorrect #10682
Comments
I don't think that your expectation is 100% accurate. However, I believe we need to make the |
Hi @oliviertassinari, I think we can update Personally, I think export interface SelectInputProps extends StandardProps<{}, SelectInputClassKey> {
...
onChange?: (event: React.ChangeEvent<HTMLSelectElement>, child: React.ReactNode) => void;
...
} export interface SelectProps extends StandardProps<InputProps, SelectClassKey, 'value' | 'onChange'> {
...
onChange: SelectInputProps['onChange'];
...
} What do you think ? |
@t49tran This sounds good to me. Do you want to submit a pull-request? :) |
Yes, I just created one. |
Expected Behavior
The Typescript type for onChange on Select should be
string[]
. Also the docs says that onChange takes two argumentsCurrent Behavior
The Typescript type for onChange on Select is
string
and the typing allows only for one argument.Steps to Reproduce (for bugs)
Im not quite sure how to reproduce typing errors using codesandbox. Please let me know if a reproduction repo is needed. If so i will quickly create a repo for that.
Due to the usage of
React.ChangeEventHandler<HTMLTextAreaElement | HTMLInputElement>
for the onChange prop the type and behavior is not identical.Context
I am trying to create a generic MultiSelect component using the Select component.
Your Environment
The text was updated successfully, but these errors were encountered: