import { Fn } from "../types/Fn"; import { Hoc } from "../types/Hoc"; interface WithRenameFn extends Fn { return: [OldProp, any] extends this["arg0"] ? Exclude | [NewProp, Extract[1]] : this["arg0"]; } type WithRenameHoc = ( /** * @example * function Box({ handleClick }: { handleClick: () => void }) { * ... * } * const NewBox = withRename("onClick", "handleClick")(Box); * // ↑ this will be the property * {}} /> * // ↑ onClick is the new prop * // is equivalent to * {}} /> */ newProp: NewProp, /** * @example * function Box({ handleClick }: { handleClick: () => void }) { * ... * } * const NewBox = withRename("onClick", "handleClick")(Box); * // ↑ this is the old prop * {}} /> * // is equivalent to * {}} /> * // ↑ this is the old prop */ oldProp: OldProp) => Hoc<[WithRenameFn]>; /** * Make your component receive a new prop by renaming it. * * @see {@link withRenames} * @example * function Box({ handleClick }: { handleClick: () => void }) { * ... * } * const NewBox = withRename("onClick", "handleClick")(Box); * {}} /> * // is equivalent to * {}} /> */ export declare const withRename: WithRenameHoc; export {}; //# sourceMappingURL=withRename.d.ts.map