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
[react] Add comment about removed index signature #24939
[react] Add comment about removed index signature #24939
Conversation
cc @pelotom |
@frenic Thank you for submitting this PR! 🔔 @johnnyreilly @bbenezech @pzavolinsky @digiguru @ericanderson @morcerf @tkrotoff @DovydasNavickas @onigoetz @theruther4d @guilhermehubner @JoshuaKGoldberg @jrakotoharisoa - please review this PR in the next few days. Be sure to explicitly select If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead. |
types/react/index.d.ts
Outdated
/** | ||
* The index signature was removed to enable closed typing for style | ||
* using CSSType. You're able to use module augmentation to add other | ||
* properties, like CSS Custom Properties, or add a index signature |
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.
“...or add an* index signature...”
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.
Thanks 👍
@frenic One or more reviewers has requested changes. Please address their comments. I'll be back once they sign off or you've pushed new commits. Thank you! |
types/react/index.d.ts
Outdated
* [index: string]: any; | ||
* } | ||
* } | ||
* ``` |
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.
Maybe also good to mention that a cheap alternative, esp. for missing properties where you don't need to reference it in multiple places, is casting:
<div style={{ ['overflowAnchor' as any]: 'auto' }}>
...
</div>
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 added that to the README at csstype
. Thanks 👍
How about adding a comment to the effect of "If you find that these typings are missing a valid CSS property or value, please check whether an issue has already been filed for it at https://github.com/frenic/csstype/issues and if not, create one." |
2a77093
to
254454b
Compare
@pelotom I changed the comment a bit and added a link to the README of |
254454b
to
6da4210
Compare
Thanks! |
This helped me debug a compile error today after updating React, thank you! |
The index signature for
React.CSSProperties
was removed to enable closed typing. In this PR I just added a comment about that and how to use module augmentation to add CSS custom properties or a index signature of their own.npm test
.)npm run lint package-name
(ortsc
if notslint.json
is present).tslint.json
containing{ "extends": "dtslint/dt.json" }
.