Skip to content

Commit 967806d

Browse files
authored
(fix) allow SapperAnchorProps & SvelteKitAnchorProps on svelte:element (#1577)
#1576
1 parent 232862d commit 967806d

File tree

7 files changed

+13
-7
lines changed

7 files changed

+13
-7
lines changed

packages/svelte2tsx/svelte-jsx.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1456,7 +1456,7 @@ declare namespace svelte.JSX {
14561456
sveltefragment: { slot?: string; };
14571457
svelteoptions: { [name: string]: any };
14581458
sveltehead: { [name: string]: any };
1459-
svelteelement: { 'this': string | undefined | null; } & HTMLProps<any> & SVGProps<any>;
1459+
svelteelement: { 'this': string | undefined | null; } & HTMLProps<any> & SVGProps<any> & SapperAnchorProps & SvelteKitAnchorProps;
14601460

14611461
[name: string]: { [name: string]: any };
14621462
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
<><a sveltekitNoscroll></a>
22
<a sveltekitPrefetch></a>
3-
<a sveltekitReload></a></>
3+
<a sveltekitReload></a>
4+
<svelteelement this="a" sveltekitPrefetch></svelteelement></>
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{ svelteHTML.createElement("a", {"sveltekit:noscroll":true,}); }
22
{ svelteHTML.createElement("a", {"sveltekit:prefetch":true,}); }
3-
{ svelteHTML.createElement("a", {"sveltekit:reload":true,}); }
3+
{ svelteHTML.createElement("a", {"sveltekit:reload":true,}); }
4+
{ svelteHTML.createElement("a", { "sveltekit:prefetch":true,}); }
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
<a sveltekit:noscroll></a>
22
<a sveltekit:prefetch></a>
33
<a sveltekit:reload></a>
4+
<svelte:element this="a" sveltekit:prefetch></svelte:element>

packages/svelte2tsx/test/svelte2tsx/samples/svelte-element/expected.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
<svelteelement this="tag" />
1010
<svelteelement this={tag ? 'a' : 'b'} />
1111
<svelteelement this={tag}>{tag}</svelteelement>
12-
<svelteelement this={tag} onclick={() => tag} /></>);
12+
<svelteelement this={tag} onclick={() => tag} />
13+
<svelteelement this={'a'} sveltekitPrefetch href="https://kit.svelte.dev" /></>);
1314
return { props: {}, slots: {}, getters: {}, events: {} }}
1415

1516
export default class Input__SvelteComponent_ extends __sveltets_1_createSvelte2TsxComponent(__sveltets_1_partial(__sveltets_1_with_any_event(render()))) {
16-
}
17+
}

packages/svelte2tsx/test/svelte2tsx/samples/svelte-element/expectedv2.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ async () => {
99
{ svelteHTML.createElement("tag", { });}
1010
{ svelteHTML.createElement(tag ? 'a' : 'b', { });}
1111
{ svelteHTML.createElement(tag, { });tag; }
12-
{ svelteHTML.createElement(tag, { "onclick":() => tag,});}};
12+
{ svelteHTML.createElement(tag, { "onclick":() => tag,});}
13+
{ svelteHTML.createElement('a', { "sveltekit:prefetch":true,"href":`https://kit.svelte.dev`,});}};
1314
return { props: {}, slots: {}, getters: {}, events: {} }}
1415

1516
export default class Input__SvelteComponent_ extends __sveltets_1_createSvelte2TsxComponent(__sveltets_1_partial(__sveltets_1_with_any_event(render()))) {
16-
}
17+
}

packages/svelte2tsx/test/svelte2tsx/samples/svelte-element/input.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
<svelte:element this={tag ? 'a' : 'b'} />
88
<svelte:element this={tag}>{tag}</svelte:element>
99
<svelte:element this={tag} on:click={() => tag} />
10+
<svelte:element this={'a'} sveltekit:prefetch href="https://kit.svelte.dev" />

0 commit comments

Comments
 (0)