From d5af772444e5bd103ce762d0745734f585842cdd Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Wed, 10 Mar 2021 08:33:50 -0500 Subject: [PATCH] fix event type parsing --- docs/getting-started/changelog.md | 1 + scripts/make-metadata.cjs | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/docs/getting-started/changelog.md b/docs/getting-started/changelog.md index c4ff3de7f..9111e1c65 100644 --- a/docs/getting-started/changelog.md +++ b/docs/getting-started/changelog.md @@ -10,6 +10,7 @@ _During the beta period, these restrictions may be relaxed in the event of a mis - Add touch support to `sl-rating` [#362](https://github.com/shoelace-style/shoelace/pull/362) - Fixed a bug where the `open` attribute on `sl-details` would prevent it from opening [#357](https://github.com/shoelace-style/shoelace/issues/357) +- Fixed event detail type parsing so component class names are shown instead of `default` ## 2.0.0-beta.30 diff --git a/scripts/make-metadata.cjs b/scripts/make-metadata.cjs index c98c0286b..0d7e81b1a 100644 --- a/scripts/make-metadata.cjs +++ b/scripts/make-metadata.cjs @@ -152,6 +152,17 @@ components.map(async component => { '{ ' + param.declaration.children .map(child => { + // Component exports aren't named, so they appear as "default" in the type data. However, we can use the + // id to link them to the right class. + if (child.type.name === 'default') { + const component = components.find(component => component.id === child.type.id); + if (component) { + child.type.name = component.name; + } else { + child.type.name = 'unknown'; + } + } + if (child.type.type === 'intrinsic' || child.type.type === 'reference') { return `${child.name}: ${child.type.name}`; } else if (child.name) {