-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[typings] Switch tabIndex from string type to number | string #8115
Conversation
Looking at JedWatson/react-select#1595 I think that we should allow both string and integer type but using integer internally in the lib. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that we should be updating the typescript definition too.
so should I change them all to be string | number then? |
My bad, the typescript are already in sync 👍 |
Yes, I think that it would be better with |
@xaviergonz Great! |
@oliviertassinari The latest release doesn't compile with TS due to this bug :(
basically it is complaining that the react type (number | undefined) and the new one (number | string | undefined) are not compatible Should I change it back to number | undefined for that particular case or them all? Another possibility would be to hand pick properties from HTMLAttributes that might be needed, but I don't know which those would be. |
@xaviergonz I would rather follow |
I don't see how they would be, they are the official ones made by react guys. IMHO it is better to use a number, since actually tabIndex has to be a number (even when transformed in the end internally to a string attribute). I guess they did it because that way you cannot mistype it as tabIndex="hello world" (which with material-ui right now is accepted but wrong), but instead have to type it as tabIndex={1234} |
Also it is more natural for TS users, since we are used to do this (due to react official typings): |
The following change for the typescript files should fix it then :) - tabIndex?: number | string;
+ tabIndex?: number; |
I'll change them then on a new pull request :) |
Does it require a new release? If it does, I will wait a day or two to collect more feedback. |
It would for TS users or they get compilation errors |
@oliviertassinari I would like a release for this fix please 🙋🏼♂️ |
Me too, the same problem when use typescript. |
I will cut a release this evening. |
Basically this fixes an inconsistency where some tabIndex props where numbers in some components and others were mistakenly typed as string (since the tabIndex type in the react official types is number, not string.