Skip to content

fix(types): adapt types of events to reduce the usage of any-type #4328

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

Merged
merged 13 commits into from
Jun 18, 2025

Conversation

michaelmkraus
Copy link
Contributor

Proposed changes

  • adapt types of events to reduce the usage of any-type

closes #4285

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (fix on existing components or architectural decisions)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Copy link
Contributor

github-actions bot commented Jun 3, 2025

@michaelmkraus michaelmkraus moved this to 👀 In review in UX Engineering Team Backlog Jun 3, 2025
@michaelmkraus michaelmkraus moved this from 👀 In review to 🏗 In development in UX Engineering Team Backlog Jun 3, 2025
michaelmkraus and others added 3 commits June 3, 2025 13:06
…tom-select

# Conflicts:
#	packages/components/src/components/custom-select/custom-select.lite.tsx
#	packages/components/src/components/custom-select/model.ts
#	packages/components/src/utils/index.ts
@nmerget nmerget enabled auto-merge (squash) June 11, 2025 11:32
@nmerget nmerget moved this from 🏗 In development to 👀 In review in UX Engineering Team Backlog Jun 12, 2025
@mfranzke mfranzke requested a review from Copilot June 16, 2025 05:07
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors event types across multiple components to reduce reliance on the any-type and improve type safety. Key changes include updating event handler signatures for components like Drawer, Tabs, Custom Select, and Tag; adapting Close/Toggle event types; and cleaning up related utility imports and type definitions.

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
showcases/angular-showcase/src/app/app.component.ts Updated toggleDrawer to coerce undefined to a boolean.
packages/components/src/utils/index.ts Added isKeyboardEvent utility for type checking events.
packages/components/src/shared/model.ts Refactored event type definitions to be more explicit.
packages/components/src/components/tag/* Updated tag event types and handlers to avoid any-type.
packages/components/src/components/tabs/* Replaced any with InputEvent for handling tab events.
packages/components/src/components/notification/* Updated event types for notification close events.
packages/components/src/components/drawer/* Refined event handling for the drawer including keyboard events.
packages/components/src/components/custom-select/* Enhanced event type signatures for dropdown, search, and close events.
packages/components/src/components/accordion-item/accordion-item.lite.tsx Minor cleanup by removing outdated TypeScript comments.
packages/components/scripts/post-build/react.ts Updated type replacements for React event types.
Comments suppressed due to low confidence (3)

showcases/angular-showcase/src/app/app.component.ts:113

  • Consider clarifying in documentation whether coercing an undefined 'open' value to false is intended behavior for toggleDrawer.
toggleDrawer = (open: boolean | void) => {

packages/components/src/components/tabs/tabs.lite.tsx:145

  • [nitpick] Consider explicitly typing the 'closest' function instead of relying on casting event.target to any to improve code clarity and maintainability.
const closest: | ((element: string) => HTMLElement | null) | undefined = (event.target as any)?.closest;

packages/components/src/components/custom-select/custom-select.lite.tsx:332

  • Replacing the magic string 'close' with undefined and a forceClose flag improves clarity; verify that all handleClose calls are updated consistently.
state.handleClose('close');

@nmerget nmerget merged commit 2747329 into main Jun 18, 2025
74 checks passed
@nmerget nmerget deleted the fix-event-typings-custom-select branch June 18, 2025 07:09
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in UX Engineering Team Backlog Jun 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

DBCustomSelect typings
2 participants