Skip to content

Commit ffa8bbd

Browse files
Sync svelte docs (#1500)
sync svelte docs Co-authored-by: svelte-docs-bot[bot] <196124396+svelte-docs-bot[bot]@users.noreply.github.com>
1 parent e5ef3b9 commit ffa8bbd

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

apps/svelte.dev/content/docs/svelte/98-reference/.generated/compile-errors.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,51 @@ Cyclical dependency detected: %cycle%
196196
`{@const}` must be the immediate child of `{#snippet}`, `{#if}`, `{:else if}`, `{:else}`, `{#each}`, `{:then}`, `{:catch}`, `<svelte:fragment>`, `<svelte:boundary` or `<Component>`
197197
```
198198

199+
### const_tag_invalid_reference
200+
201+
```
202+
The `{@const %name% = ...}` declaration is not available in this snippet
203+
```
204+
205+
The following is an error:
206+
207+
```svelte
208+
<svelte:boundary>
209+
{@const foo = 'bar'}
210+
211+
{#snippet failed()}
212+
{foo}
213+
{/snippet}
214+
</svelte:boundary>
215+
```
216+
217+
Here, `foo` is not available inside `failed`. The top level code inside `<svelte:boundary>` becomes part of the implicit `children` snippet, in other words the above code is equivalent to this:
218+
219+
```svelte
220+
<svelte:boundary>
221+
{#snippet children()}
222+
{@const foo = 'bar'}
223+
{/snippet}
224+
225+
{#snippet failed()}
226+
{foo}
227+
{/snippet}
228+
</svelte:boundary>
229+
```
230+
231+
The same applies to components:
232+
233+
```svelte
234+
<Component>
235+
{@const foo = 'bar'}
236+
237+
{#snippet someProp()}
238+
<!-- error -->
239+
{foo}
240+
{/snippet}
241+
</Component>
242+
```
243+
199244
### constant_assignment
200245

201246
```

apps/svelte.dev/content/docs/svelte/98-reference/30-compiler-errors.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,51 @@ Cyclical dependency detected: %cycle%
201201
`{@const}` must be the immediate child of `{#snippet}`, `{#if}`, `{:else if}`, `{:else}`, `{#each}`, `{:then}`, `{:catch}`, `<svelte:fragment>`, `<svelte:boundary` or `<Component>`
202202
```
203203

204+
### const_tag_invalid_reference
205+
206+
```
207+
The `{@const %name% = ...}` declaration is not available in this snippet
208+
```
209+
210+
The following is an error:
211+
212+
```svelte
213+
<svelte:boundary>
214+
{@const foo = 'bar'}
215+
216+
{#snippet failed()}
217+
{foo}
218+
{/snippet}
219+
</svelte:boundary>
220+
```
221+
222+
Here, `foo` is not available inside `failed`. The top level code inside `<svelte:boundary>` becomes part of the implicit `children` snippet, in other words the above code is equivalent to this:
223+
224+
```svelte
225+
<svelte:boundary>
226+
{#snippet children()}
227+
{@const foo = 'bar'}
228+
{/snippet}
229+
230+
{#snippet failed()}
231+
{foo}
232+
{/snippet}
233+
</svelte:boundary>
234+
```
235+
236+
The same applies to components:
237+
238+
```svelte
239+
<Component>
240+
{@const foo = 'bar'}
241+
242+
{#snippet someProp()}
243+
<!-- error -->
244+
{foo}
245+
{/snippet}
246+
</Component>
247+
```
248+
204249
### constant_assignment
205250

206251
```

0 commit comments

Comments
 (0)