diff --git a/packages/compound-component/src/CompoundComponent/CompoundComponent.tsx b/packages/compound-component/src/CompoundComponent/CompoundComponent.tsx index 7b6e95f011..abbedd9c3b 100644 --- a/packages/compound-component/src/CompoundComponent/CompoundComponent.tsx +++ b/packages/compound-component/src/CompoundComponent/CompoundComponent.tsx @@ -1,7 +1,7 @@ import { ComponentType } from 'react'; /** Generic properties applied to a Compound component */ -interface CompoundComponentProperties { +interface CompoundComponentStaticProperties { displayName: string; [key: string]: any; // Typed as `any` to avoid issues with a mapped object } @@ -9,8 +9,8 @@ interface CompoundComponentProperties { /** Return type of a CompoundComponent */ export type CompoundComponentType< Props extends {} = {}, - Properties extends CompoundComponentProperties = CompoundComponentProperties, -> = ComponentType & Properties; + StaticProperties extends CompoundComponentStaticProperties = CompoundComponentStaticProperties, +> = ComponentType & StaticProperties; /** * Factory function used to create a compound component parent. @@ -26,15 +26,15 @@ export type CompoundComponentType< * // Renders * ``` * @param componentRenderFn The component render function - * @param properties Object describing the `displayName` and any sub-components + * @param staticProperties Object describing the `displayName` and any sub-components * @returns {CompoundComponentType} */ export const CompoundComponent = < Props extends {} = {}, - Properties extends CompoundComponentProperties = CompoundComponentProperties, + StaticProperties extends CompoundComponentStaticProperties = CompoundComponentStaticProperties, >( componentRenderFn: ComponentType, - properties: Properties, -): CompoundComponentType => { - return Object.assign(componentRenderFn, properties); + staticProperties: StaticProperties, +): CompoundComponentType => { + return Object.assign(componentRenderFn, staticProperties); }; diff --git a/packages/compound-component/src/CompoundComponent/SubComponent.tsx b/packages/compound-component/src/CompoundComponent/SubComponent.tsx index 4e9e16e7f5..bf85343280 100644 --- a/packages/compound-component/src/CompoundComponent/SubComponent.tsx +++ b/packages/compound-component/src/CompoundComponent/SubComponent.tsx @@ -1,6 +1,6 @@ import { ComponentType } from 'react'; -interface SubComponentProperties { +interface SubComponentStaticProperties { displayName: string; key: Key; } @@ -26,14 +26,14 @@ export type SubComponentType< * ``` * * @param componentRenderFn The component render function - * @param properties Object describing the `displayName` and `key` + * @param staticProperties Object describing the `displayName` and `key` * @returns {SubComponentType} */ export const CompoundSubComponent = ( componentRenderFn: ComponentType, - properties: SubComponentProperties, + staticProperties: SubComponentStaticProperties, ): SubComponentType => { - const { key, ...rest } = properties; + const { key, ...rest } = staticProperties; return Object.assign(componentRenderFn, { ...rest, [key]: true,