custom-elements-language-server icon indicating copy to clipboard operation
custom-elements-language-server copied to clipboard

Report type errors in attributes & properties of elements

Open Matsuuu opened this issue 3 years ago • 1 comments

Given I have an elements

export type ComponentVariant = "default" | "primary" | "secondary";

class MyComponent extends LitElement {
    @property({ type: String })
    variant: ComponentVariant = "default";
}

I would want to get diagnostic help when the typing of my attribute doesn't match the one provided.

e.g.

<my-component variant="foobar"></my-component>

Should throw an diagnostics error and underline the variant="foobar" section of the component with an error message like Type '"foobar"' is not assignable to type 'ComponentVariant'

Matsuuu avatar Apr 24 '23 05:04 Matsuuu

Some stuff related to this is here: https://github.com/Matsuuu/tsc-checker-demoing

Will be continuing on this work next as this will be a major feature

Matsuuu avatar Aug 22 '23 14:08 Matsuuu