runem / lit-analyzer

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

With TypeScript 4.8 we seem to only see info from .d.ts files #278

Closed rictic closed 1 year ago

rictic commented 1 year ago

Consider this repro: https://github.com/HalfdanJ/lit-element-starter-ts (recommend opening a github codespace to get a stand alone fresh install of the VSCode plugin, with only local configuration)

With a same-project import of some-element, we still get an unknown tag warning unless it's added to the HTMLElementTagNameMap, and even if it is we get an unknown attribute warning unless we add an @attr jsdoc tag to SomeElement. It's as though the analyzer can't see the @property or @customElement decorators

rictic commented 1 year ago

We should add a unit test configuration with TS 4.8

rictic commented 1 year ago

@bicknellr

bicknellr commented 1 year ago

I just now put two and two together and realized this is the same as the internal bug we were handed recently. Recap: TypeScript 4.8 changes the location of decorators in the AST and web-component-analyzer's discoverDefinitions for Lit specifically expects to find decorators in the old position. I'm working on adding support for TypeScript 4.8 in https://github.com/runem/web-component-analyzer/pull/249, which includes updates to look for decorators in the new location.

pmcelhaney commented 1 year ago

That PR has been merged but there hasn't been a release since then. Pretty pretty please can you cut a new release? 😄

SimonAlling commented 1 year ago

A new version of this package based on a not-yet-released version of web-component-analyzer would indeed be highly appreciated. Until that happens, many consumers – especially those who use "no-unknown-tag-name": "error" etc – cannot upgrade to TypeScript 4.8 and beyond. I don't know how releases are managed or by whom … @runem, @rictic, @bicknellr?

rictic commented 1 year ago

This should be fixed now, install the @next version