I'm working with Svelte and typescript, and I'd like to add type definitions to the html elements I'm referencing.
For example I have something like this:
<script>
let closeButtonEl;
let prevFocused;
[...]
prevFocused = document.activeElement;
[...]
</script>
[...]
<button bind:this={closeButtonEl}>Click me</button>
That is, I have a closeButtonEl
which I know for sure is a button, and a prevFocused
which is an HTMLElement with a focus()
method.
What type should I use for each of them? And where is that kind of things documented?