ionic-team / stencil-ds-output-targets

These are output targets that can be added to Stencil for React and Angular.
https://stenciljs.com
MIT License
251 stars 117 forks source link

feat: expose input properties to Angular Language Server #497

Closed kristilw closed 3 weeks ago

kristilw commented 1 month ago

Pull request checklist

Please check if your PR fulfills the following requirements:

Pull request type

Please check the type of change your PR introduces:

(I would call this a feature, but it has been reported as a bug)

What is the current behavior?

Issue URL: https://github.com/ionic-team/stencil/issues/2909

The Angular Language Service is not able to type-check or show jsdocs for input properties. This is because of a limitation of how the Angular Language Service works: https://github.com/angular/angular/issues/48056.

What is the new behavior?

Angular is able to verifty types on input properties and show jsDocs: b

Does this introduce a breaking change?

Feature is hidden behind experimental flag, inlineProperties.

I have tested the code on both the example component-library and our own internal design system (which has about 70 components), but there might be some unkown edge cases.

Other information

Ideally this would be solved by the Angular team, but it has been an open problem for years.

If this MR goes through it is easy to extend the code to support types/jsDocs for output properties as well. The method used to create the correct property declerations are a lot simpler than the current method used to create EventEmitters today, and I believe more robust. The current implementation fails on Array, Promises, functions or when multiple Interfaces shares the same name in the project (such as Color in the example component-library). The method used in this MR to create the input proprties does not require any additional import statements either.

alexandertrefz commented 3 weeks ago

@gnbm @christian-bromann Please review this PR that fixes such a long standing issue, I beg of you. The merge conflict is a single line in the Readme.

kristilw commented 3 weeks ago

Rebased with main, conflict should be resolved