-
-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow
as
expressions for bindable props (#2372)
* feat: allow `as` expressions for bindable props * chore: add test to ts-runes-bindable * chore: copy paste expected without formatting * chore: test tabs vs spaces * chore: fix expected for svelte 5
- Loading branch information
1 parent
80622df
commit 3147c81
Showing
4 changed files
with
11 additions
and
6 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
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
6 changes: 3 additions & 3 deletions
6
packages/svelte2tsx/test/svelte2tsx/samples/ts-runes-bindable/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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
///<reference types="svelte" /> | ||
;function render() { | ||
/*Ωignore_startΩ*/;type $$ComponentProps = { a: unknown, b?: unknown };/*Ωignore_endΩ*/ | ||
let { a, b = $bindable() }: $$ComponentProps = $props(); | ||
/*Ωignore_startΩ*/;type $$ComponentProps = { a: unknown, b?: unknown, c?: number };/*Ωignore_endΩ*/ | ||
let { a, b = $bindable(), c = $bindable(0) as number }: $$ComponentProps = $props(); | ||
; | ||
async () => {}; | ||
return { props: {} as any as $$ComponentProps, slots: {}, events: {} }} | ||
|
||
export default class Input__SvelteComponent_ extends __sveltets_2_createSvelte2TsxComponent(__sveltets_2_with_any_event(render())) { | ||
constructor(options = __sveltets_2_runes_constructor(__sveltets_2_with_any_event(render()))) { super(options); } | ||
$$bindings = __sveltets_$$bindings('b'); | ||
$$bindings = __sveltets_$$bindings('b', 'c'); | ||
} |
2 changes: 1 addition & 1 deletion
2
packages/svelte2tsx/test/svelte2tsx/samples/ts-runes-bindable/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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<script lang="ts"> | ||
let { a, b = $bindable() } = $props(); | ||
let { a, b = $bindable(), c = $bindable(0) as number } = $props(); | ||
</script> |