-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
TSX support attribute object literal shorthand #31797
Comments
Since you're the TSX expert, I assume you may have thoughts on it. |
This is better proposed to the JSX spec. If it's accepted there, it'll surely find its way into Typescript |
Proposed for the JSX spec here: facebook/jsx#23 |
said JSX pr with BNF grammar change: facebook/jsx#118 |
The problem I find with proposals to the JSX spec is that they go untouched for years. This issue was created in 2014, and has had no action. Another issue (facebook/jsx#66) was created in 2016 and is a relatively trivial change. Even worse, there is no response from the maintainers even after being directly pinged. That's the case in both issues. TypeScript is a superset of JavaScript, why not also make it a superset of JSX? |
These proposals need to start with the JSX folks. I'm vaguely surprised (but happy) it doesn't already parse as a sequence expression 😅 |
Just curious, What do you mean by sequence expression? Yeah jsx folks have been non-active for years. I tried pinging some contributors so let’s see where this goes. |
The expression |
I've just created facebook/jsx#119. Let's see what happens; I absolutely intend on forking the spec and updating it if Facebook doesn't consider proposals that have been open for multiple years. |
This issue has been marked as 'External' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
Search Terms
tsx attribute shorthand, object shorthand
Suggestion
ES6 has this great syntax of passing key value pairs in objects e.g.
but in TSX land this doesn't transfer well e.g.
typescript throws an error that it needs a
TS1005: '...' expected
.It instead needs to be written as
which seems very boiler platey.
It would be awesome if we could make a small tweak to pass attributes like es6 shorthand.
so all of these would be equal
They would all be emitted as
Use Cases
Examples
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: