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

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

Open rictic opened this issue 2 years ago • 3 comments

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 avatar Sep 22 '22 17:09 rictic

We should add a unit test configuration with TS 4.8

rictic avatar Sep 22 '22 17:09 rictic

@bicknellr

rictic avatar Sep 22 '22 18:09 rictic

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.

bicknellr avatar Oct 17 '22 18:10 bicknellr

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

pmcelhaney avatar Jan 17 '23 19:01 pmcelhaney

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?

SimonAlling avatar Mar 09 '23 08:03 SimonAlling

This should be fixed now, install the @next version

rictic avatar Jun 20 '23 18:06 rictic