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
2 changes: 1 addition & 1 deletion packages/svelte2tsx/src/svelte2tsx/nodes/Stores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function handleStore(node: Node, parent: Node, str: MagicString): void {
str.overwrite(
parent.start,
parent.end,
`${storename}.set( $${storename} ${simpleOperator} 1)`
`(${storename}.set( $${storename} ${simpleOperator} 1), $${storename})`
);
} else {
console.warn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export function processInstanceScriptContent(
str.overwrite(
parent.getStart() + astOffset,
parent.end + astOffset,
`${storename}.set( $${storename} ${simpleOperator} 1)`
`(${storename}.set( $${storename} ${simpleOperator} 1), $${storename})`
);
return;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ function render() {


const count = writable(0)/*Ωignore_startΩ*/;let $count = __sveltets_1_store_get(count);/*Ωignore_endΩ*/;
const handler1 = () => count.set( $count + 1)
const handler2 = () => count.set( $count - 1)
const handler1 = () => (count.set( $count + 1), $count)
const handler2 = () => (count.set( $count - 1), $count)
;
() => (<>

<button onclick={() => count.set( $count + 1)}>add</button>
<button onclick={() => count.set( $count - 1)}>subtract</button>
<button onclick={() => count.set( $count + 1)}>add</button></>);
<button onclick={() => (count.set( $count + 1), $count)}>add</button>
<button onclick={() => (count.set( $count - 1), $count)}>subtract</button>
<button onclick={() => (count.set( $count + 1), $count)}>add</button></>);
return { props: {}, slots: {}, getters: {}, events: {} }}

export default class Input__SvelteComponent_ extends __sveltets_1_createSvelte2TsxComponent(__sveltets_1_partial(__sveltets_1_with_any_event(render()))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ function render() {


const count = writable(0)/*Ωignore_startΩ*/;let $count = __sveltets_1_store_get(count);/*Ωignore_endΩ*/;
const handler1 = () => count.set( $count + 1)
const handler2 = () => count.set( $count - 1)
const handler1 = () => (count.set( $count + 1), $count)
const handler2 = () => (count.set( $count - 1), $count)
;
async () => {

{ svelteHTML.createElement("button", { "onclick":() => count.set( $count + 1),}); }
{ svelteHTML.createElement("button", { "onclick":() => count.set( $count - 1),}); }
{ svelteHTML.createElement("button", { "onclick":() => count.set( $count + 1),}); }};
{ svelteHTML.createElement("button", { "onclick":() => (count.set( $count + 1), $count),}); }
{ svelteHTML.createElement("button", { "onclick":() => (count.set( $count - 1), $count),}); }
{ svelteHTML.createElement("button", { "onclick":() => (count.set( $count + 1), $count),}); }};
return { props: {}, slots: {}, getters: {}, events: {} }}

export default class Input__SvelteComponent_ extends __sveltets_1_createSvelte2TsxComponent(__sveltets_1_partial(__sveltets_1_with_any_event(render()))) {
Expand Down