Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assignment to const variable in inline event handler is ignored #4895

Closed
goodhoko opened this issue May 23, 2020 · 2 comments · Fixed by #4960
Closed

Assignment to const variable in inline event handler is ignored #4895

goodhoko opened this issue May 23, 2020 · 2 comments · Fixed by #4960

Comments

@goodhoko
Copy link

goodhoko commented May 23, 2020

Describe the bug
When an inline event handler assigns to a const variable no error is raised and the assigment is silently ignored.

To Reproduce

  • repl
  • minimal example:
<script>
	const immutable = true
</script>
<button on:click={_ => immutable = false }>bug me!</button>

Expected behavior
A compile time error is raised.

Information about your Svelte project:
I have no project yet. I was just going thru the official tutorial where I noticed this.

Severity
For me, not annoying at all. Yet. .)

Additional context
Have a nice day!

@stale
Copy link

stale bot commented Dec 24, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@Conduitry
Copy link
Member

This is now a compile-time error in 3.52.0 - https://svelte.dev/repl/2c8e583e379f49b3af2066f08ad5c2ba?version=3.52.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants