Skip to content

Commit

Permalink
Work around bind:this type mismatch
Browse files Browse the repository at this point in the history
Address this failure:

    .../halo/src/lib/FracInput.svelte:74:24
    Error: 'input' is possibly 'undefined'. (ts)
            oninput={() => {
                rawValue = input.value
            }}

In practice this is likely harmless, as `bind:this={input}` means that
variable should be bound by the time it emits an input event.
Nonetheless, take the value from the event to avoid closing over `input`.
  • Loading branch information
twm committed Nov 8, 2024
1 parent 85b3b67 commit 6fc6b60
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/FracInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
value={focused ? rawValue : displayValue}
bind:this={input}
{required}
oninput={() => {
rawValue = input.value
oninput={(e) => {
rawValue = e.currentTarget.value
}}
onfocus={() => {
focused = true
Expand Down

0 comments on commit 6fc6b60

Please sign in to comment.