/** * It's a concept that's being considered for addition * * This code allows the builder to expose only certain properties of a component. * But do users accept this type of operation? */ declare class Component { getProps(): unknown; } declare class DrivedComponent extends Component { value1: number; } interface DrivedComponent2Props { value1: number; func1: (value: number) => number; } declare class DrivedComponent2 extends Component { getProps(): DrivedComponent2Props; value1: number; func1: (value: number) => number; func2: (value: number) => number; } type UnwrapUnknown = T extends unknown ? unknown extends T ? never : T : T; type GetProps = T["getProps"] extends (() => infer U) ? UnwrapUnknown : never; type GetPropsOrComponent = GetProps extends never ? T : GetProps; declare function withComponent(componentCtor: new (...args: any[]) => T, callback: (component: GetPropsOrComponent) => void): void;