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

DismissButton, RadioCard::Group, RichTooltip::Toggle - Type safety fixes #2401

Merged
merged 5 commits into from
Sep 10, 2024

Conversation

alex-ju
Copy link
Member

@alex-ju alex-ju commented Sep 10, 2024

📌 Summary

As we converted all our components to TypeScript I did a thorough check and discovered a few instances where glint ignore was not removed:

  • DismissButton: needed it to be removed
  • RadioCard::Group: removing it revealed a complexity where Field and Fieldset share the layout argument, but have different values for them (vertical/flag and vertical/horizontal, respectively)
  • RichTooltip::Toggle: removing it meant the logic needed small adjustments (open to alternatives/suggestions)

👀 Component checklist

💬 Please consider using conventional comments when reviewing this PR.

Glint doesn't seem to be smart enough to recognize composable helpers, so we split the logic to make it happy.
Requires fixing the `HdsFormFieldsetLayoutValues` enum
Copy link

vercel bot commented Sep 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
hds-showcase ✅ Ready (Inspect) Visit Preview Sep 10, 2024 1:41pm
hds-website ✅ Ready (Inspect) Visit Preview Sep 10, 2024 1:41pm

@@ -131,10 +132,10 @@ export default class HdsFormField extends Component<HdsFormFieldSignature> {

@action
appendDescriptor(element: HTMLElement): void {
registerAriaDescriptionElement(this, element);
registerAriaDescriptionElement(this as AriaDescribedByComponent, element);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AriaDescribedByComponent is a more generic component signature covering the Field and Fieldset components (both potentially having descriptors, such as HelperText and Error). Their signatures vary in a sense that @layout has different values, so we're doing this casting here to ensure TypeScript that they are matching the more generic type. I couldn't find an alternative, but open to suggestions.

@alex-ju alex-ju merged commit 7e4f2f9 into main Sep 10, 2024
16 checks passed
@alex-ju alex-ju deleted the alex-ju/typescript-fixes branch September 10, 2024 15:52
@hashibot-hds hashibot-hds mentioned this pull request Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants