Skip to content

Commit

Permalink
fix: adjust generated +layout.svelte file contents (#2580)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
  • Loading branch information
YpsilonTM and dummdidumm authored Nov 11, 2024
1 parent 49c7e58 commit bf1b8ef
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,38 @@ const defaultScriptTemplate = `
/** @type {import('./$types').LayoutData} */
export let data;
</script>
<slot />
`;

const tsSv5ScriptTemplate = `
<script lang="ts">
import type { Snippet } from 'svelte';
import type { LayoutData } from './$types';
let { data }: LayoutData = $props();
let { data, children }: { data: LayoutData, children: Snippet } = $props();
</script>
{@render children()}
`;

const tsScriptTemplate = `
<script lang="ts">
import type { LayoutData } from './$types';
export let data: LayoutData;
</script>
<slot />
`;

const jsSv5ScriptTemplate = `
<script>
/** @type {import('./$types').LayoutData} */
let { data } = $props();
/** @type {{ data: import('./$types').LayoutData, children: import('svelte').Snippet }} */
let { data, children } = $props();
</script>
{@render children()}
`;

const scriptTemplate: ReadonlyMap<ProjectType, string> = new Map([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ const defaultScriptTemplate = `
const tsSv5ScriptTemplate = `
<script lang="ts">
import type { PageData } from './$types';
let { data }: PageData = $props();
let { data }: { data: PageData } = $props();
</script>
`;

const tsScriptTemplate = `
<script lang="ts">
import type { PageData } from './$types';
export let data: PageData;
</script>
`;

const jsSv5ScriptTemplate = `
<script>
/** @type {import('./$types').PageData} */
/** @type {{ data: import('./$types').PageData }} */
let { data } = $props();
</script>
`;
Expand Down

0 comments on commit bf1b8ef

Please sign in to comment.