File tree 2 files changed +18
-9
lines changed
packages/svelte-vscode/src/sveltekit/generateFiles/templates
2 files changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -5,29 +5,38 @@ const defaultScriptTemplate = `
5
5
/** @type {import('./$types').LayoutData} */
6
6
export let data;
7
7
</script>
8
+
9
+ <slot />
8
10
` ;
9
11
10
12
const tsSv5ScriptTemplate = `
11
13
<script lang="ts">
14
+ import type { Snippet } from 'svelte';
12
15
import type { LayoutData } from './$types';
13
-
14
- let { data }: LayoutData = $props();
16
+
17
+ let { data, children }: { data: LayoutData, children: Snippet } = $props();
15
18
</script>
19
+
20
+ {@render children()}
16
21
` ;
17
22
18
23
const tsScriptTemplate = `
19
24
<script lang="ts">
20
25
import type { LayoutData } from './$types';
21
-
26
+
22
27
export let data: LayoutData;
23
28
</script>
29
+
30
+ <slot />
24
31
` ;
25
32
26
33
const jsSv5ScriptTemplate = `
27
34
<script>
28
- /** @type {import('./$types').LayoutData} */
29
- let { data } = $props();
35
+ /** @type {{ data: import('./$types').LayoutData, children: import('svelte').Snippet } } */
36
+ let { data, children } = $props();
30
37
</script>
38
+
39
+ {@render children()}
31
40
` ;
32
41
33
42
const scriptTemplate : ReadonlyMap < ProjectType , string > = new Map ( [
Original file line number Diff line number Diff line change @@ -10,22 +10,22 @@ const defaultScriptTemplate = `
10
10
const tsSv5ScriptTemplate = `
11
11
<script lang="ts">
12
12
import type { PageData } from './$types';
13
-
14
- let { data }: PageData = $props();
13
+
14
+ let { data }: { data: PageData } = $props();
15
15
</script>
16
16
` ;
17
17
18
18
const tsScriptTemplate = `
19
19
<script lang="ts">
20
20
import type { PageData } from './$types';
21
-
21
+
22
22
export let data: PageData;
23
23
</script>
24
24
` ;
25
25
26
26
const jsSv5ScriptTemplate = `
27
27
<script>
28
- /** @type {import('./$types').PageData} */
28
+ /** @type {{ data: import('./$types').PageData } } */
29
29
let { data } = $props();
30
30
</script>
31
31
` ;
You can’t perform that action at this time.
0 commit comments