@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
13 lines (12 loc) • 776 B
TypeScript
/** use this to ensure that all cases are covered in case of a selection */
export declare function assertUnreachable(x: never): never;
export declare function isNotUndefined<T>(x: T | undefined): x is T;
export declare function isUndefined<T>(x: T | undefined): x is undefined;
export declare function isNotNull<T>(x: T | null): x is T;
export type GuardMessage = string | (() => string);
/**
* @param assertion - will be asserted
* @param message - if a string, we will use it as the error message, if it is a function, we will call it to produce the error message (can be used to avoid costly message generations)
* @throws GuardError - if the assertion fails
*/
export declare function guard(assertion: unknown | undefined, message?: GuardMessage): asserts assertion;