lit-analyzer icon indicating copy to clipboard operation
lit-analyzer copied to clipboard

Assignment incorrectly flagged as invalid

Open dstoc opened this issue 9 months ago • 0 comments

Repro:

import {LitElement, html} from 'lit';
import {customElement, property} from 'lit/decorators.js';

interface A {
  a: number;
}

interface B {
  b: number;
}

@customElement('test-element')
export class Test extends LitElement {
  @property({attribute: false}) prop?: A & B;
  override render() {
    return html` <test-element .prop=${this.prop!}></test-element> `;
  }
}

Error:

    Type 'A & B' is not assignable to 'A & B | undefined'
    16:  n html` <test-element .prop=${this.prop!}></test-e
    no-incompatible-type-binding

[email protected]

dstoc avatar May 10 '24 01:05 dstoc