lit-analyzer
lit-analyzer copied to clipboard
Allow setting directive to undefined
I often set a directive as potentially undefined:
`<hgroup
${shouldDoSomething ? ref(() => doSomething()) : undefined}
>...</hgroup>
`
lit-analyzer flags this as incorrect:
Type 'DirectiveResult<DirectiveClass> | undefined' is not a Lit 2 directive'
...
no-incompatible-type-binding
is this use case really incorrect? In practice it seems that lit is happy with it and just drops the directive. This is much simpler than e.g. writing two different hgroups above (with only the directive being different between the two) and using one or the other.