-
-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: properly transform
$props.id
when $props
is assigned to props
- Loading branch information
1 parent
a24d819
commit a5d694b
Showing
9 changed files
with
114 additions
and
4 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
13 changes: 13 additions & 0 deletions
13
...te2tsx/test/svelte2tsx/samples/props-variable-and-$props.id-destructured.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/** @typedef {{ props: any }} $$ComponentProps *//** @type {$$ComponentProps} */ { props } = $props(); | ||
let id = $props.id(); | ||
; | ||
async () => { | ||
|
||
id; props;}; | ||
return { props: /** @type {$$ComponentProps} */({}), exports: {}, bindings: __sveltets_$$bindings(''), slots: {}, events: {} }} | ||
const Input__SvelteComponent_ = __sveltets_2_fn_component($$render()); | ||
type Input__SvelteComponent_ = ReturnType<typeof Input__SvelteComponent_>; | ||
export default Input__SvelteComponent_; |
6 changes: 6 additions & 0 deletions
6
...lte2tsx/test/svelte2tsx/samples/props-variable-and-$props.id-destructured.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,6 @@ | ||
<script> | ||
let { props } = $props(); | ||
let id = $props.id(); | ||
</script> | ||
|
||
{id} {props} |
13 changes: 13 additions & 0 deletions
13
...tsx/test/svelte2tsx/samples/props-variable-and-$props.id-not-$props-init.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 props = {}/*Ωignore_startΩ*/;let $props = __sveltets_2_store_get(props);/*Ωignore_endΩ*/; | ||
let id = $props.id(); | ||
; | ||
async () => { | ||
|
||
id; props;}; | ||
return { props: /** @type {Record<string, never>} */ ({}), exports: {}, bindings: "", slots: {}, events: {} }} | ||
const Input__SvelteComponent_ = __sveltets_2_isomorphic_component(__sveltets_2_partial(__sveltets_2_with_any_event($$render()))); | ||
/*Ωignore_startΩ*/type Input__SvelteComponent_ = InstanceType<typeof Input__SvelteComponent_>; | ||
/*Ωignore_endΩ*/export default Input__SvelteComponent_; |
6 changes: 6 additions & 0 deletions
6
...2tsx/test/svelte2tsx/samples/props-variable-and-$props.id-not-$props-init.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,6 @@ | ||
<script> | ||
let props = {}; | ||
let id = $props.id(); | ||
</script> | ||
|
||
{id} {props} |
13 changes: 13 additions & 0 deletions
13
...s/svelte2tsx/test/svelte2tsx/samples/props-variable-and-$props.id-spread.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/** @typedef {Record<string, any>} $$ComponentProps *//** @type {$$ComponentProps} */ {...props} = $props(); | ||
let id = $props.id(); | ||
; | ||
async () => { | ||
|
||
id; props;}; | ||
return { props: /** @type {$$ComponentProps} */({}), exports: {}, bindings: __sveltets_$$bindings(''), slots: {}, events: {} }} | ||
const Input__SvelteComponent_ = __sveltets_2_fn_component($$render()); | ||
type Input__SvelteComponent_ = ReturnType<typeof Input__SvelteComponent_>; | ||
export default Input__SvelteComponent_; |
6 changes: 6 additions & 0 deletions
6
...es/svelte2tsx/test/svelte2tsx/samples/props-variable-and-$props.id-spread.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,6 @@ | ||
<script> | ||
let {...props} = $props(); | ||
let id = $props.id(); | ||
</script> | ||
|
||
{id} {props} |
13 changes: 13 additions & 0 deletions
13
packages/svelte2tsx/test/svelte2tsx/samples/props-variable-and-$props.id.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 props = $props(); | ||
let id = $props.id(); | ||
; | ||
async () => { | ||
|
||
id; props;}; | ||
return { props: /** @type {$$ComponentProps} */({}), exports: {}, bindings: __sveltets_$$bindings(''), slots: {}, events: {} }} | ||
const Input__SvelteComponent_ = __sveltets_2_fn_component($$render()); | ||
type Input__SvelteComponent_ = ReturnType<typeof Input__SvelteComponent_>; | ||
export default Input__SvelteComponent_; |
6 changes: 6 additions & 0 deletions
6
packages/svelte2tsx/test/svelte2tsx/samples/props-variable-and-$props.id.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,6 @@ | ||
<script> | ||
let props = $props(); | ||
let id = $props.id(); | ||
</script> | ||
|
||
{id} {props} |