Files
NapCatQQ/.pnpm-store/v3/files/92/fb74f7f616f5cc51b66707bf1e56f6ea84744a2aef64700c4a2585a47ca7b690e9cc1978d9b8c8c4efa6dbce4fee91c1598be9959189e146f0c49f18629f7d
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

37 lines
1.4 KiB
Plaintext

import { Ref, MutableRefObject } from 'react';
interface Props {
[key: string]: any;
}
type PropsArg = Props | null | undefined;
type TupleTypes<T> = {
[P in keyof T]: T[P];
} extends {
[key: number]: infer V;
} ? NullToObject<V> : never;
type NullToObject<T> = T extends null | undefined ? {} : T;
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
/**
* Calls all functions in the order they were chained with the same arguments.
*/
declare function chain(...callbacks: any[]): (...args: any[]) => void;
declare let idsUpdaterMap: Map<string, {
current: string | null;
}[]>;
/**
* Merges two ids.
* Different ids will trigger a side-effect and re-render components hooked up with `useId`.
*/
declare function mergeIds(idA: string, idB: string): string;
/**
* Merges multiple props objects together. Event handlers are chained,
* classNames are combined, and ids are deduplicated - different ids
* will trigger a side-effect and re-render components hooked up with `useId`.
* For all other props, the last prop object overrides all previous ones.
* @param args - Multiple sets of props to merge together.
*/
declare function mergeProps<T extends PropsArg[]>(...args: T): UnionToIntersection<TupleTypes<T>>;
declare function mergeRefs<T>(...refs: Array<Ref<T> | MutableRefObject<T> | null | undefined>): Ref<T>;
export { chain, idsUpdaterMap, mergeIds, mergeProps, mergeRefs };