Skip to content

Conversation

jnumainville
Copy link
Contributor

Part of work for DH-19416 and a followup from #2477

If no props are specified for React.ComponentType it defaults to {}, allowing no props. We need to specify that we can have any.

@jnumainville jnumainville requested a review from mofojed July 18, 2025 14:55
export type ElementName = string;

/** A mapping of element names to their React components. */
export type ElementPluginMappingDefinition = Record<
Copy link
Member

Choose a reason for hiding this comment

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

For these two types it'd be better to type the props with a Generic. See how we do it ComponentUtils, but would be something like this:

export type ElementPluginMappingDefinition<P extends Record<string, unknown> = {}> = Record<ElementName, React.ComponentType<P>>;

We get better typing that way when using it, and we don't need to use any.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I've got something generic working now

Copy link

codecov bot commented Jul 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 44.67%. Comparing base (5d15019) to head (8a9c3f2).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2498   +/-   ##
=======================================
  Coverage   44.67%   44.67%           
=======================================
  Files         762      762           
  Lines       42617    42617           
  Branches    10710    10710           
=======================================
  Hits        19038    19038           
  Misses      23568    23568           
  Partials       11       11           
Flag Coverage Δ
unit 44.67% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@mofojed mofojed left a comment

Choose a reason for hiding this comment

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

As long as you've tried this in your template and it's working then I think we're good.

@jnumainville
Copy link
Contributor Author

Yep I don't see any errors with the generated template

@jnumainville jnumainville merged commit 8c8edd5 into deephaven:main Jul 21, 2025
11 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jul 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants