@fast-check/poisoning
Version:
Set of utilities to ease detection and revert of poisoning
20 lines (19 loc) • 852 B
TypeScript
/** Alias for Array.prototype.map */
export declare const MapSymbol: unique symbol;
/** Alias for Array.prototype.push */
export declare const PushSymbol: unique symbol;
/** Alias for Array.prototype.shift */
export declare const ShiftSymbol: unique symbol;
/** Alias for Array.prototype.sort */
export declare const SortSymbol: unique symbol;
/** Array instance enriched with aliased methods that cannot be poisoned */
export type PoisoningFreeArray<T> = Array<T> & {
[MapSymbol]: <U>(mapper: (v: T) => U) => Array<U>;
[PushSymbol]: (...values: T[]) => void;
[ShiftSymbol]: () => T | undefined;
[SortSymbol]: (compare: (keyA: T, keyB: T) => number) => T[];
};
/** Factory responsible to build instances of PoisoningFreeArray */
export declare const PoisoningFreeArray: {
from<T>(arrayLike: ArrayLike<T>): PoisoningFreeArray<T>;
};