Skip to content

"number | null" is not reactive #14819

@Tb1281

Description

@Tb1281

Describe the bug

Following code is not working as I expected. It only shows 0 (or nothing)

<script lang="ts">
  let test: number | null = $state(null);
</script>

{test}
<button onclick={() => (test = test ? test + 1 : 0)}>btn</button>

Reproduction

https://svelte.dev/playground/f75dcf3250e644fe9bfbdab647b83e71?version=5.15.0

Logs

No response

System Info

All

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting submitterneeds a reproduction, or clarification

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions