-
-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: include named exports in svelte 5 type (#2528)
fixes sveltejs/svelte#13508
- Loading branch information
1 parent
4dfb988
commit b12afd1
Showing
10 changed files
with
157 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<svelte:options runes /> | ||
|
||
<script> | ||
export let value; | ||
let name = "world" | ||
let name2 = "world" | ||
export { name as name3, name2 as name4 }; | ||
</script> | ||
|
||
{#if value} | ||
<input bind:value on:change /> | ||
{/if} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
packages/svelte2tsx/test/svelte2tsx/samples/export-list-runes.v5/expectedv2.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
///<reference types="svelte" /> | ||
;function render() { | ||
|
||
let name1 = "world" | ||
let name2/*Ωignore_startΩ*/;name2 = __sveltets_2_any(name2);/*Ωignore_endΩ*/ | ||
|
||
let rename1 = ''; | ||
let rename2/*Ωignore_startΩ*/;rename2 = __sveltets_2_any(rename2);/*Ωignore_endΩ*/; | ||
|
||
class Foo {} | ||
function bar() {} | ||
const baz = ''; | ||
|
||
class RenameFoo {} | ||
function renamebar() {} | ||
const renamebaz = ''; | ||
|
||
|
||
; | ||
async () => { { svelteHTML.createElement("svelte:options", {"runes":true,});} | ||
|
||
}; | ||
return { props: /** @type {Record<string, never>} */ ({}), exports: /** @type {{name1: typeof name1,name2: typeof name2,renamed1: typeof rename1,renamed2: typeof rename2,Foo: typeof Foo,bar: typeof bar,baz: typeof baz,RenamedFoo: typeof RenameFoo,renamedbar: typeof renamebar,renamedbaz: typeof renamebaz}} */ ({}), bindings: __sveltets_$$bindings(''), slots: {}, events: {} }} | ||
const Input__SvelteComponent_ = __sveltets_2_fn_component(render()); | ||
export default Input__SvelteComponent_; |
19 changes: 19 additions & 0 deletions
19
packages/svelte2tsx/test/svelte2tsx/samples/export-list-runes.v5/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<svelte:options runes /> | ||
|
||
<script> | ||
let name1 = "world" | ||
let name2 | ||
let rename1 = ''; | ||
let rename2; | ||
class Foo {} | ||
function bar() {} | ||
const baz = ''; | ||
class RenameFoo {} | ||
function renamebar() {} | ||
const renamebaz = ''; | ||
export { name1, name2, rename1 as renamed1, rename2 as renamed2, Foo, bar, baz, RenameFoo as RenamedFoo, renamebar as renamedbar, renamebaz as renamedbaz }; | ||
</script> |
13 changes: 13 additions & 0 deletions
13
packages/svelte2tsx/test/svelte2tsx/samples/renamed-exports-runes.v5/expectedv2.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
///<reference types="svelte" /> | ||
;function render() { | ||
|
||
let name = "world" | ||
let name2 = "world" | ||
|
||
; | ||
async () => { { svelteHTML.createElement("svelte:options", {"runes":true,});} | ||
|
||
}; | ||
return { props: /** @type {Record<string, never>} */ ({}), exports: /** @type {{name3: typeof name,name4: typeof name2}} */ ({}), bindings: __sveltets_$$bindings(''), slots: {}, events: {} }} | ||
const Input__SvelteComponent_ = __sveltets_2_fn_component(render()); | ||
export default Input__SvelteComponent_; |
7 changes: 7 additions & 0 deletions
7
packages/svelte2tsx/test/svelte2tsx/samples/renamed-exports-runes.v5/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<svelte:options runes /> | ||
|
||
<script> | ||
let name = "world" | ||
let name2 = "world" | ||
export { name as name3, name2 as name4 }; | ||
</script> |
25 changes: 25 additions & 0 deletions
25
packages/svelte2tsx/test/svelte2tsx/samples/ts-export-list-runes.v5/expectedv2.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
///<reference types="svelte" /> | ||
;function render() { | ||
|
||
let name1: string = "world"/*Ωignore_startΩ*/;name1 = __sveltets_2_any(name1);/*Ωignore_endΩ*/ | ||
let name2: string/*Ωignore_startΩ*/;name2 = __sveltets_2_any(name2);/*Ωignore_endΩ*/; | ||
let name3: string = ''/*Ωignore_startΩ*/;name3 = __sveltets_2_any(name3);/*Ωignore_endΩ*/;let name4: string/*Ωignore_startΩ*/;name4 = __sveltets_2_any(name4);/*Ωignore_endΩ*/; | ||
|
||
let rename1: string = ''/*Ωignore_startΩ*/;rename1 = __sveltets_2_any(rename1);/*Ωignore_endΩ*/; | ||
let rename2: string/*Ωignore_startΩ*/;rename2 = __sveltets_2_any(rename2);/*Ωignore_endΩ*/; | ||
|
||
class Foo {} | ||
function bar() {} | ||
const baz: string = ''; | ||
|
||
class RenameFoo {} | ||
function renamebar() {} | ||
const renamebaz: string = ''; | ||
|
||
|
||
; | ||
async () => { { svelteHTML.createElement("svelte:options", {"runes":true,});} | ||
}; | ||
return { props: {} as Record<string, never>, exports: {} as any as { name1: string,name2: string,name3: string,name4: string,renamed1: string,renamed2: string,Foo: typeof Foo,bar: typeof bar,baz: string,RenamedFoo: typeof RenameFoo,renamedbar: typeof renamebar,renamedbaz: string }, bindings: __sveltets_$$bindings(''), slots: {}, events: {} }} | ||
const Input__SvelteComponent_ = __sveltets_2_fn_component(render()); | ||
export default Input__SvelteComponent_; |
19 changes: 19 additions & 0 deletions
19
packages/svelte2tsx/test/svelte2tsx/samples/ts-export-list-runes.v5/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<svelte:options runes /> | ||
<script> | ||
let name1: string = "world" | ||
let name2: string; | ||
let name3: string = '', name4: string; | ||
let rename1: string = ''; | ||
let rename2: string; | ||
class Foo {} | ||
function bar() {} | ||
const baz: string = ''; | ||
class RenameFoo {} | ||
function renamebar() {} | ||
const renamebaz: string = ''; | ||
export { name1, name2, name3, name4, rename1 as renamed1, rename2 as renamed2, Foo, bar, baz, RenameFoo as RenamedFoo, renamebar as renamedbar, renamebaz as renamedbaz }; | ||
</script> |