I'm trying to implement TypeScript in Svelte and have problem with event handlers in custom elements. When I write someting like:
<CustomComponent
on:itemclick={() => dispatch("item", item)}
on:doSometing={onDoSomethingHandler}
on:doSomethingElse={onDoSomethingElseHandler}>
</CustomComponent>
And now the funny thing: the first two will generate error:
Object is of type 'unknown'
but not the last one. Of course all on: methods (itemClick, doSomething, doSomethingElse) are dispatched from CustomComponent. Whether I remove the first two handlers, the error will disappear. As far as I know the problem occurs only on custom components. But don't know why some works and some doesn't... Any idea?