1- import type { ComponentType } from "react" ;
2-
3- import type { ComponentProps } from "@/components/Component" ;
4-
5- export type ComponentRegistration =
6- | ComponentType < Record < string , unknown > >
7- | ComponentType < ComponentProps > ;
1+ import type { RegistrableComponent } from "@/types/state/plugin" ;
82
93/**
104 * A registry for Chartlets components.
@@ -29,14 +23,14 @@ export interface Registry {
2923 * @param type The Chartlets component's unique type name.
3024 * @param component A functional React component.
3125 */
32- register ( type : string , component : ComponentRegistration ) : ( ) => void ;
26+ register ( type : string , component : RegistrableComponent ) : ( ) => void ;
3327
3428 /**
3529 * Lookup the component of the provided type.
3630 *
3731 * @param type The Chartlets component's type name.
3832 */
39- lookup ( type : string ) : ComponentRegistration | undefined ;
33+ lookup ( type : string ) : RegistrableComponent | undefined ;
4034
4135 /**
4236 * Clears the registry.
@@ -52,9 +46,9 @@ export interface Registry {
5246
5347// export for testing only
5448export class RegistryImpl implements Registry {
55- private components = new Map < string , ComponentRegistration > ( ) ;
49+ private components = new Map < string , RegistrableComponent > ( ) ;
5650
57- register ( type : string , component : ComponentRegistration ) : ( ) => void {
51+ register ( type : string , component : RegistrableComponent ) : ( ) => void {
5852 const oldComponent = this . components . get ( type ) ;
5953 this . components . set ( type , component ) ;
6054 return ( ) => {
@@ -66,7 +60,7 @@ export class RegistryImpl implements Registry {
6660 } ;
6761 }
6862
69- lookup ( type : string ) : ComponentRegistration | undefined {
63+ lookup ( type : string ) : RegistrableComponent | undefined {
7064 return this . components . get ( type ) ;
7165 }
7266
0 commit comments