-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Primitive literals in computed property names #4653
Comments
See #1082 for some previous discussion on computed property names in interfaces. |
will this work in your case? declare module JSX {
interface IntrinsicElements {
"my-element": __React.HTMLAttributes
}
}
<my-element autoPlay/> |
I guess that it reflects syntax for defining object literals. Also string\numeric literals as names in properties were allowed in TypeScript long before ES6 support was added |
Both of those forms are valid in classes (where someone would actually migrate JS to TS). Would be reasonable to support both in interfaces for consistency sake. |
Also was confused by this recently. Consider #2225 Don't really know if string literals should be in computed property names but you should be able to see those strings somewhere. |
@DanielRosenwasser in the chrome devtools, one can write obj.t/**/ get completions at the marker, and recieve the list of properties
select obj["thing-explainer"]/**/ I think this is the behavior we want to be able to replicate. (as far as completions go) |
should be addressed in #5535 |
Looking at #4648 brought this up -
We should allow string literals in computed property names in interfaces. Right now we only allow well-know symbols, but allowing all primitive literals (of valid indexer types, I suppose) should be supported.
This is a spec change - section 2.2.3 would need to be updated to reflect this, but, IMO, is fairly important and worth the change. We can't strongly type, say,
tslint.json
result structures right now, as we lack this.The text was updated successfully, but these errors were encountered: