Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analyzer : Inherited properties don't work when extending a local variable #277

Open
2 tasks done
Lookwe69 opened this issue Aug 21, 2024 · 0 comments
Open
2 tasks done

Comments

@Lookwe69
Copy link

Lookwe69 commented Aug 21, 2024

Checklist

  • Did you run the analyzer with the --dev flag to get more information?
  • Did you create a minimal reproduction in the playground?

Playground: https://custom-elements-manifest.netlify.app/?source=CmltcG9ydCB7IExpdEVsZW1lbnQgfSBmcm9tICdsaXQtZWxlbWVudCc7CgpleHBvcnQgZnVuY3Rpb24gbWl4aW5FbGVtZW50SW50ZXJuYWxzKGJhc2UpIHsKCWFic3RyYWN0IGNsYXNzIFdpdGhFbGVtZW50SW50ZXJuYWxzRWxlbWVudCBleHRlbmRzIGJhc2UgewoJCWdldCBpbnRlcm5hbHMoKSB7CgkJCXJldHVybiB0aGlzLiNpbnRlcm5hbHM7CgkJfQoKCQkjaW50ZXJuYWxzID0gdGhpcy5hdHRhY2hJbnRlcm5hbHMoKTsKCX0KCglyZXR1cm4gV2l0aEVsZW1lbnRJbnRlcm5hbHNFbGVtZW50Owp9CgpleHBvcnQgY2xhc3MgTXlFbGVtZW50IGV4dGVuZHMgbWl4aW5FbGVtZW50SW50ZXJuYWxzKExpdEVsZW1lbnQpIHsKICBteU1ldGhvZCgpe30KfQoKY29uc3QgQmFzZUNsYXNzID0gbWl4aW5FbGVtZW50SW50ZXJuYWxzKExpdEVsZW1lbnQpOwoKZXhwb3J0IGNsYXNzIE15RWxlbWVudFdpdGhvdXRNaXhpblByb3BlcnRpZXMgZXh0ZW5kcyBCYXNlQ2xhc3MgewogIG15TWV0aG9kKCl7fQp9Cg%3D%3D&library=litelement

TLDR: When you do something like:

const BaseClass = mixinFunc(HTMLElement);

class MyElement extends BaseClass { ... }

The inherit properties never get added to the custom elements manifest.
You must use :

class MyElement extends mixinFunc(HTMLElement) { ... }

The problem is, with a lot of mixin, it easier to read with a separate variable.

const BaseClass = mixinTooltipChart(
	mixinGridChart(mixinLegendChart<typeof Chart<LineChartOption, LineChartData>>(Chart)),
);

export class LineChart extends BaseClass { ... }

Expected behavior
It must be possible to create a separate variable before extending the class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant