Files
compiler-explorer/static
Matt GodboltandClaude fcfd5cb863 Address @junlarsen's PR feedback and improve createDragSource API
This commit addresses all feedback from @junlarsen in PR #7801:

1. **Remove default generic parameter from ComponentConfig**: Added explicit
   AnyComponentConfig type alias instead of default parameter, improving type
   clarity and preventing accidental usage of overly broad types.

2. **Keep typeof pattern for component configs**: After consideration, we kept
   the `ComponentConfig<typeof COMPONENT_NAME>` pattern rather than creating
   individual type aliases (CompilerComponentConfig, etc.) because:
   - Maintains single source of truth (component name constant drives everything)
   - Zero maintenance burden (no additional aliases to maintain)
   - Better refactoring safety (changing component name only requires updating constant)
   - Type safety is preserved (misspelled constants caught at compile time)

3. **Use Pick types for options parameters**: Replaced inline object types with
   `Pick<AnyComponentConfig, ...>` and `Pick<LayoutItem, ...>` to ensure options
   match the actual interface properties exactly.

4. **Remove section comment**: Removed the large comment block as suggested,
   keeping the code cleaner and more focused.

5. **Document GoldenLayout type issues**: The existing TODO and comments properly
   explain the TypeScript definition issues with GoldenLayout.

6. **Add targeted Sentry reporting**: Added SentryCapture only for the specific
   case that should never happen with proper typing (unknown component names).

**Additional improvement**: Simplified createDragSource API by returning the
EventEmitter directly instead of requiring callers to access ._dragListener.
Updated 25+ call sites from:
  `createDragSource(...).&#95;dragListener.on(...)`
to:
  `createDragSource(...).on(...)`

This hides implementation details and provides a cleaner, more intuitive API.

Thanks to @junlarsen for the thorough code review and excellent suggestions\!

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-17 17:19:54 -05:00
..
2025-05-19 06:51:21 -05:00
2025-02-26 02:07:09 +02:00
2025-02-26 02:07:09 +02:00
2024-10-25 12:19:04 +03:00
2025-04-24 12:10:37 -05:00
2025-04-24 12:10:37 -05:00