Skip to content

5.43.0: Cannot destructure property with @const if undefined #17224

@henrykrinkle01

Description

@henrykrinkle01

Describe the bug

<script>
	//It works if comment out `await`;
	const obj = await { foo: 'foo' };
</script>

{#if true}
	{@const { foo, bar } = obj}
	{foo}
	{bar}
{/if}

This used to work in 5.42.3. Only happens with async objects.

Reproduction

https://svelte.dev/playground/6e298c8f77a340f5b0d1da9b2f922c43?version=5.42.3
https://svelte.dev/playground/6e298c8f77a340f5b0d1da9b2f922c43?version=5.43.0

Logs

System Info

svelte@5.43.14

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions