-
- Notifications
You must be signed in to change notification settings - Fork 4.7k
[feat] Implement RFC 33 - Constants in markup #6413
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
[feat] Implement RFC 33 - Constants in markup #6413
Conversation
70e4128 to c534da3 Compare | @benmccann hmm.. but the |
| I'm not sure it'd be possible to lint the |
c5dd882 to 42652bb Compare 42652bb to 2bbc535 Compare | The test failures here look to be genuine, and appear to be related to TypeScript complaining about types. |
| Hi guys, what would be the showstopper here? This looks wonderful and I personally couldn't wait to use it. |
2bbc535 to 78fe8a2 Compare | I've just pushed a change to update the wording of a couple of compiler error messages. @tanhauhau Is there a reason for only allowing In particular, why is |
| Based on my use cases for const, most of the time it would work best in an |
| Looks like the work is completed here guys? When are we expecting this to be merged |
00a4a9b to 79063bd Compare | Thanks so much for the great work @tanhauhau ! |
| Wow, terrific work @tanhauhau! Task: <script> let cats = [ { id: 'J---aiyznGQ', name: 'Keyboard Cat', weight: 8}, { id: 'z_AbfPXTKms', name: 'Maru', weight: 11 }, { id: 'OUtn3pvWmpg', name: 'Henri The Existential Cat' , weight: 15} ]; </script> <h1>The Famous Cats of YouTube</h1> <ul> <!-- open each block --> <!-- declare constant --> <li><a target="_blank" href="https://www.youtube.com/watch?v={cat.id}"> {cat.name} is a healthy {catWeight} kg! </a></li> <!-- close each block --> </ul> Solution: <script> let cats = [ { id: 'J---aiyznGQ', name: 'Keyboard Cat', weight: 8}, { id: 'z_AbfPXTKms', name: 'Maru', weight: 11 }, { id: 'OUtn3pvWmpg', name: 'Henri The Existential Cat' , weight: 15} ]; </script> <h1>The Famous Cats of YouTube</h1> <ul> {#each cats as { id, name, weight }, i} <li><a target="_blank" href="https://www.youtube.com/watch?v={id}"> {@const catWeight = weight / 2.205} {i + 1}: {name} is a healthy {catWeight} kg! </a></li> {/each} </ul>Maybe {@const } should get a whole tutorial section of its own though? |
| @Theo-Steiner imo every tag should be introduced one at a time as to not overwhelm beginners. |
| Personally, I don't like the keyword |
7c6baff to 965669f Compare 854cc3d to bb5ad3b Compare | Poor Constantine Plotnikov is being pinged to no end from this PR. 😄 |
| 🤷 I tried putting the reference in the commit message in backticks, but it doesn't seem like that prevents the ping there. Oh well! |
| Wait, why doesn't it work in if else? :O |
I also wonder it there's any reason why the (I'm not sure if this is the right place to post this question, given that the PR is already closed...) |
It is now though, no? |
Implementing sveltejs/rfcs#33
Before submitting the PR, please make sure you do the following
Tests
npm testand lint the project withnpm run lint