[react] Updated interface HTMLAttributes#8236
Merged
Merged
Conversation
Added [key:string]: any; to HTMLAttributes to Support data- and aria- Attributes, which are unsupported currently.
Member
| unselectable?: boolean; | ||
|
|
||
| // Allows aria- and data- Attributes | ||
| [key: string]: any; |
Contributor
There was a problem hiding this comment.
How do you feel about : string?
Contributor
Author
There was a problem hiding this comment.
: string is not possible, since typescript understands, that we have an accessor here, which will be able to target any of the defined fields.
Nevertheless the smalles form I can find is [key: string]: string | string[] | boolean | EventHandler<SyntheticEvent> | {__html: string}; and I will update the PR accordingly.
Contributor
There was a problem hiding this comment.
ah, right. I'm not too fussed about this; I think any will do just fine.
The HTMLAttribute was updated to Support data-* and aria-* Attributes. Since `any` is possibly to broad, the Definition allows any type used in HTMLAttributes and DOMAttributes.
Contributor
Author
|
This has to be postponed I think - microsoft/TypeScript#7029 there seem to be a problem with this sort of signature... |
The explicit form of the indexer `[key: string]: string | string[] | boolean | number | EventHandler<SyntheticEvent> | CSSProperties | {__html: string};` Fails in TravisCI - so any is currently the way to go.
Contributor
Author
|
I think we can stick to this version :) |
vvakame
added a commit
that referenced
this pull request
Feb 26, 2016
[react] Updated interface HTMLAttributes
Closed
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added [key:string]: any; to HTMLAttributes to Support data- and aria- Attributes, which are unsupported currently.