@freik/typechk
Version:
Core set of TS/JS type checking helpers
16 lines (15 loc) • 741 B
TypeScript
import { SimpleObject, typecheck } from './Types.js';
export type ToFlat<T> = (data: T) => SimpleObject;
export type FromFlat<T> = (data: SimpleObject) => T | undefined;
export declare enum RegistrationResult {
Success = 0,
Already = 1,
Fail = 2,
DetectionFailure = 3
}
export declare function registerPickling(): RegistrationResult;
export declare function Pickle(input: unknown): string;
export declare function Unpickle(input: string): unknown;
export declare function UnsafelyUnpickle<T>(input: string): T;
export declare function SafelyUnpickle<T>(input: string, check: typecheck<T>): T | undefined;
export declare function RegisterForPickling<T>(pickleTag: symbol, fromString: FromFlat<T>, toString?: ToFlat<T>): void;