runem / lit-analyzer

Monorepository for tools that analyze lit-html templates
MIT License
317 stars 36 forks source link

Add proper event types for @ notation #265

Open Kokujou opened 2 years ago

Kokujou commented 2 years ago

Hi guys. i really want to set the "noImplicitAny" flag in my JSConfig, but in order to do that, i desperately need types to @-events. for addEventListener it already works splendid but in the @-notation the event parameter is still the any-type.

of course you can simply not add the anonymous function notation ( (e)=>{...} ) and instead bind your event by name like @click="${this._handleClick}", but this only works if you have no additional parameters, which is very likely.

the other way to prevent it is to have inline JSDoc notation but... you might agree that it's very ugly to have a JSDoc comment for a basically redundant type in the midst of your HTML code

please consider fixing this.

Kokujou commented 1 year ago

push? attention please? i know it's an annoying issue but it's a frequent error source if you can't properly detect the type of events, especially of custom events. you have the correct type from the dispatch event source, tehre must be a possibility to properly parse it and match those two types together.