@sourcebug/amos
Version:
A decentralized state manager for react
40 lines (39 loc) • 1.1 kB
TypeScript
/**
* Returns the first argument
* @param v
*/
export declare const identity: <T>(v: T) => T;
/**
* Check two objects is shallow equal or not
* @param a
* @param b
*/
export declare function shallowEqual<T extends object>(a: T, b: T): boolean;
/**
* Copy properties from src function to dst function, and returns dst
*
* @param src
* @param dst
*/
export declare function hoistMethod<M extends (...args: any[]) => any>(src: M, dst: (...args: Parameters<M>) => ReturnType<M>): M;
export declare const kAmosObject: unique symbol;
/**
* A symbol indicates the object is a amos' object.
*/
export interface AmosObject<K extends string> {
[kAmosObject]: K;
}
/**
* Check an object is an amos object or not
*
* @param key
* @param o
*/
export declare function isAmosObject<T extends AmosObject<any>>(key: T[typeof kAmosObject], o: any): o is T;
/**
* Check two array is shallow equal or not
* @param a
* @param b
*/
export declare function arrayEqual<T extends ArrayLike<any>>(a: T, b: T): boolean;
export declare function config<T extends object>(this: T, options: object): T;