-
Notifications
You must be signed in to change notification settings - Fork 10
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
Conversation
🔭🐙🐈 Test this branch here: https://db-ux-design-system.github.io/core-web/review/fix-event-typings-custom-select |
…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
packages/components/src/components/custom-select/custom-select.lite.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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');
Co-authored-by: Michael Kraus <michael.m.kraus@deutschebahn.com>
Co-authored-by: Michael Kraus <michael.m.kraus@deutschebahn.com>
Proposed changes
closes #4285
Types of changes