-
Notifications
You must be signed in to change notification settings - Fork 27
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
Ability to document type of detail property for CustomEvents #124
Comments
This would be a nice feature, because a lot of the events of a web component is a custom event. Having But this would mean that types must also be definable, because having For string, number and boolean this is no problem. ....
"events": [{
"name": "layout-changed",
"type": {
"text": "CustomEvent",
"detail": {
"type": {
"text": "string"
}
}
}
}] Maybe something like a OpenApi / swagger type definition could work? |
I had the same idea but then what about functions that would be placed in that event ? I came myself to the conclusion the current Here is an example. Let's say you are working on a component and you want to send an event relative to an {
"name": "event-selected",
"type": {
"text": "CustomEvent<Event>",
"references": [
{
"name": "CustomEvent",
"package": "global:"
},
{
"name": "Event",
"package": "https://raw.githubusercontent.com/webcomponents/custom-elements-manifest/main/schema.d.ts"
}
]
}
} In order to use those types with Typescript, a compiler would find all those |
After thinking for a while about that topic, it seems to me that the OpenApi and Typescript idea is not a good solution. The schema contains already a It looks to me that |
I think you're too focused on The point is to create documentation, not make its redaction impossible. You can start from a design before you start developing. |
@grimly There is more then the documentation use case. Editor Support
BTW, I like your idea to write the manifest first and develop later. As i understand the feature request from @superchris , this should be an optional feature. |
I don't know if there is a way to do this that I'm not aware of, but it would be great to add more type information about the detail property of CustomEvents that an element can dispatch. Thanks!
The text was updated successfully, but these errors were encountered: