Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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