refactor: type Input's events

This commit is contained in:
Tomáš Mládek 2024-07-13 20:42:33 +02:00
parent 197a862f3f
commit d0d92de2b6

View file

@ -2,12 +2,16 @@
import { createEventDispatcher } from 'svelte';
let input: HTMLInputElement;
const dispatch = createEventDispatcher();
const dispatch = createEventDispatcher<{
focusChange: boolean;
input: string;
}>();
export let placeholder = '';
export let value = '';
export let disabled = false;
export let size: number | undefined = 7;
export let klass = '';
let focused = false;
$: dispatch('focusChange', focused);
@ -21,7 +25,7 @@
}
</script>
<div class="input" class:focused>
<div class="input {klass}" class:focused>
<slot name="prefix" />
<input
bind:this={input}