mute-structs
Version:
NodeJS module providing an implementation of the LogootSplit CRDT algorithm
18 lines (17 loc) • 543 B
TypeScript
export declare type NonFunctionNames<T> = {
[k in keyof T]: T[k] extends Function ? never : k;
}[keyof T];
export declare type Unknown<T> = {
[k in NonFunctionNames<T>]?: unknown;
};
/**
* Example:
* Given `x: unknown`
* `isObject<{ p: number }>(x) && typeof x.p === "number"`
* enables to test if x is conforms to `{ p: number }`.
*
* @param x
* @param Is `x' a non-null object?
*/
export declare const isObject: <T>(x: unknown) => x is Unknown<T>;
export declare function isArrayFromMap(o: unknown): o is [unknown, unknown];