-
-
Notifications
You must be signed in to change notification settings - Fork 4.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
Allow omitting the as
clause in each
statement
#8348
Comments
as
clause in `each statementas
clause in each
statement
Can you post an actual example where this would be needed? As this is much simpler written as: <div style:width="{indent * 10}px" /> Even if there is such an example, I don't think it warrants the additional syntax. This is also a duplicate of #2968 because you just want to iterate N times. Such a |
Closing in favor of #2968 |
@hgiesel Consider reopening this? Now that Svelte 4 supports iterators, this could be the syntax for a range expression
|
@oscarhermoso Sure! With the support for iterators, this makes a whole lot more sense than a new keyword |
I think I like this idea. I'd want to be able to include the index in It's a small change, but it feels less messy and more intentional. It seems like there's a potential ambiguity with TypeScript (if there's only one Reasons not to do this:
Having said that, #2968 is an extraordinarily popular feature request, and this seems like a better solution to that problem. |
(closed by accident) |
Describe the problem
It would be nice if we could forego the
as
part of an#each
statement, if we don't need it.Currently we have to write it like this.
This is probably a
good first issue
Describe the proposed solution
Instead we could just write
{#each param}{/each}
Alternatives considered
Just assign to
_
, as I have done above.Importance
nice to have
The text was updated successfully, but these errors were encountered: