Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

Labelling explicit types for anonymous function in HTML part of svelte component

$
0
0

I have a svelte component in Foo.svelte that looks like this:

<script lang="ts">    ...</script><input on:input={(evt) => console.log("hello there")} />

Eslint gives me an error for the <input> line complaining that the anonymous function doesn't have an explicit return type.

Missing return type on function.eslint@typescript-eslint/explicit-function-return-type

If I try to label the types in the function like (evt: Target): void => console.log("hello there") I get a svelte parser error and eslint unexpected token error.

Am I labelling the types wrong, missing a configuration or is typing anonymous function not possible with svelte?

I know it's possible to turn off the eslint rule, but I would rather keep it.


Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>