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

CustomEvent type information not output as expected #248

Open
gavinbarron opened this issue Aug 24, 2022 · 0 comments
Open

CustomEvent type information not output as expected #248

gavinbarron opened this issue Aug 24, 2022 · 0 comments

Comments

@gavinbarron
Copy link

gavinbarron commented Aug 24, 2022

Hi,
Thanks for this really useful library, I'm part of the team working on Microsoft Graph Toolkit.
We're currently using web component analyzer to help us build our React wrapper library @microsoft/mgt-react

We're looking to improve the developer experience for consumers of our web components by adding the information to the Generic types used when emitting CustomEvents, I found #169 and the linked playground which looks exactly like what we need, so it might be that #157 will resolve this?

I experimented with both 1.1.6 and 2.0.0-next.4 and got the same result in my trials to get better type information.

Given the jsdoc comment fragment on a web component:

* @fires {CustomEvent<IDynamicPerson[]>} selectionChanged - Fired when set of selected people changes

I get varying output depending on the output type with a loss of fidelity that is problematic for our scenario.
Markdown:

| Event              | Type                            | Description                               |
|--------------------|---------------------------------|-------------------------------------------|
| `selectionChanged` | `CustomEvent<IDynamicPerson[]>` | Fired when set of selected people changes |

json2

"events": [
  {
    "description": "Fired when set of selected people changes",
    "name": "selectionChanged",
    "type": "CustomEvent"
  },

The type that is present in the md output is exactly what I'd expect to be provided when producing json2 output

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