Skip to content

[react] Updated interface HTMLAttributes#8236

Merged
vvakame merged 3 commits into
DefinitelyTyped:masterfrom
glatzert:master
Feb 26, 2016
Merged

[react] Updated interface HTMLAttributes#8236
vvakame merged 3 commits into
DefinitelyTyped:masterfrom
glatzert:master

Conversation

@glatzert

Copy link
Copy Markdown
Contributor

Added [key:string]: any; to HTMLAttributes to Support data- and aria- Attributes, which are unsupported currently.

Added [key:string]: any; to HTMLAttributes to Support data- and aria- Attributes, which are unsupported currently.
@dt-bot

dt-bot commented Feb 24, 2016

Copy link
Copy Markdown
Member

react/react.d.ts

to authors (@pspeter3 @vsiao AssureSign (account can't be detected) Microsoft (account can't be detected)). Could you review this PR?
👍 or 👎?

Checklist

  • pass the Travis CI test?

@glatzert glatzert changed the title Updated interface HTMLAttributes [react] Updated interface HTMLAttributes Feb 24, 2016
Comment thread react/react.d.ts
unselectable?: boolean;

// Allows aria- and data- Attributes
[key: string]: any;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you feel about : string?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

: 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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@glatzert

Copy link
Copy Markdown
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.
@glatzert

Copy link
Copy Markdown
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
@vvakame vvakame merged commit 1f626c2 into DefinitelyTyped:master Feb 26, 2016
@wmill wmill mentioned this pull request Jun 27, 2016
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.

4 participants