vaadin / web-components

A set of high-quality standards based web components for enterprise web applications. Part of Vaadin 20+
https://vaadin.com/docs/latest/components
447 stars 83 forks source link

Importing component from theme folder misses types #7073

Closed steverep closed 8 months ago

steverep commented 8 months ago

Description

Files in the theme/*/ folders have no Typescript declarations. This means that importing from these folders misses defining the elements on the global HTMLElementTagNameMap. As a result, a linting rule like no-missing-import from lit-plugin fails, and other rules cannot be checked because there's no class to associate the tag with.

There's a very old related issue #237, but this problem could easily be fixed just by putting TS declarations in the theme folders.

Expected outcome

Element should be defined on the global map.

Minimal reproducible example

import "@vaadin/combo-box/theme/material/vaadin-combo-box-light";
import { html } from "lit";

// Not linted because type not defined...
const temp = html`<vaadin-combo-box-light></vaadin-combo-box-light>`;

Steps to reproduce

Import from theme folder and lint with lit-plugin or lit-analyzer.

Environment

n/a

Browsers

No response

web-padawan commented 8 months ago

Thanks for the issue. Apart from lit-analyzer, the fact that .d.ts files are lacking also affects dynamic imports:

Screenshot 2024-01-12 at 10 40 04