mirror of https://github.com/sveltejs/svelte
fix: handle TypeScript's optional parameter syntax in snippets (#10671)
fixes #10530pull/10674/head
parent
b1b51a404b
commit
1ac313594c
@ -0,0 +1,5 @@
|
||||
---
|
||||
"svelte": patch
|
||||
---
|
||||
|
||||
fix: handle TypeScript's optional parameter syntax in snippets
|
@ -0,0 +1,5 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
html: '1 2 3 4 5'
|
||||
});
|
@ -0,0 +1,24 @@
|
||||
<script lang="ts">
|
||||
</script>
|
||||
|
||||
{#snippet counter1(c: number)}
|
||||
{c}
|
||||
{/snippet}
|
||||
{#snippet counter2({ c }: {c: number})}
|
||||
{c}
|
||||
{/snippet}
|
||||
{#snippet counter3(c?: number)}
|
||||
{c}
|
||||
{/snippet}
|
||||
{#snippet counter4(c: number = 4)}
|
||||
{c}
|
||||
{/snippet}
|
||||
{#snippet counter5(c?: number = 5)}
|
||||
{c}
|
||||
{/snippet}
|
||||
|
||||
{@render counter1(1)}
|
||||
{@render counter2({ c: 2 })}
|
||||
{@render counter3(3)}
|
||||
{@render counter4()}
|
||||
{@render counter5()}
|
Loading…
Reference in new issue