mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* First draft * Tweak spaces * Add tests * Expect void not undefined * Expand callbacks, they can't be wrapped * Fix test Compile error in typescript@3.6 but not in typescript@3.7 * Fix strict-export-declare-modifiers * Try and retrigger build checks
77 lines
3.9 KiB
TypeScript
77 lines
3.9 KiB
TypeScript
// Type definitions for conditional 5.3
|
|
// Project: https://github.com/anshulverma/conditional
|
|
// Definitions by: Richard Wang <https://github.com/rzhw>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
|
|
export as namespace preconditions;
|
|
|
|
// Turn off automatic exporting since this type alias shouldn't get exported.
|
|
export {};
|
|
type ErrorCallback<T> = (err: T | null) => void;
|
|
|
|
export class IllegalArgumentError extends Error {
|
|
constructor(message?: string);
|
|
}
|
|
|
|
export class IllegalStateError extends Error {
|
|
constructor(message?: string);
|
|
}
|
|
|
|
export class IllegalValueError extends Error {
|
|
constructor(message?: string);
|
|
}
|
|
|
|
export class InvalidTypeError extends Error {
|
|
constructor(message?: string);
|
|
}
|
|
|
|
export class UndefinedValueError extends Error {
|
|
constructor(message?: string);
|
|
}
|
|
|
|
export class UnknownValueError extends Error {
|
|
constructor(message?: string);
|
|
}
|
|
|
|
export function checkArgument(condition: any, message?: string, callback?: ErrorCallback<IllegalArgumentError>): void;
|
|
export function checkArgument(condition: any, callback?: ErrorCallback<IllegalArgumentError>): void;
|
|
|
|
export function checkState(condition: any, message?: string, callback?: ErrorCallback<IllegalStateError>): void;
|
|
export function checkState(condition: any, callback?: ErrorCallback<IllegalStateError>): void;
|
|
|
|
export function checkNumberType(value: any, message?: string, callback?: ErrorCallback<InvalidTypeError>): void;
|
|
export function checkNumberType(value: any, callback?: ErrorCallback<InvalidTypeError>): void;
|
|
|
|
export function checkNotNumberType(value: any, message?: string, callback?: ErrorCallback<InvalidTypeError>): void;
|
|
export function checkNotNumberType(value: any, callback?: ErrorCallback<InvalidTypeError>): void;
|
|
|
|
export function checkContains(value: any, object: any, message?: string, callback?: ErrorCallback<UnknownValueError>): void;
|
|
export function checkContains(value: any, object: any, callback?: ErrorCallback<UnknownValueError>): void;
|
|
|
|
export function checkDoesNotContain(value: any, object: any, message?: string, callback?: ErrorCallback<UnknownValueError>): void;
|
|
export function checkDoesNotContain(value: any, object: any, callback?: ErrorCallback<UnknownValueError>): void;
|
|
|
|
export function checkEquals(actual: any, expected: any, message?: string, callback?: ErrorCallback<UnknownValueError>): void;
|
|
export function checkEquals(actual: any, expected: any, callback?: ErrorCallback<UnknownValueError>): void;
|
|
|
|
export function checkDoesNotEqual(actual: any, expected: any, message?: string, callback?: ErrorCallback<UnknownValueError>): void;
|
|
export function checkDoesNotEqual(actual: any, expected: any, callback?: ErrorCallback<UnknownValueError>): void;
|
|
|
|
export function checkDefined(value: any, message?: string, callback?: ErrorCallback<UndefinedValueError>): void;
|
|
export function checkDefined(value: any, callback?: ErrorCallback<UndefinedValueError>): void;
|
|
|
|
export function checkUndefined(value: any, message?: string, callback?: ErrorCallback<UndefinedValueError>): void;
|
|
export function checkUndefined(value: any, callback?: ErrorCallback<UndefinedValueError>): void;
|
|
|
|
export function checkEmpty(value: any, message?: string, callback?: ErrorCallback<IllegalValueError>): void;
|
|
export function checkEmpty(value: any, callback?: ErrorCallback<IllegalValueError>): void;
|
|
|
|
export function checkNotEmpty(value: any, message?: string, callback?: ErrorCallback<IllegalValueError>): void;
|
|
export function checkNotEmpty(value: any, callback?: ErrorCallback<IllegalValueError>): void;
|
|
|
|
export function checkNull(value: any, message?: string, callback?: ErrorCallback<IllegalValueError>): void;
|
|
export function checkNull(value: any, callback?: ErrorCallback<IllegalValueError>): void;
|
|
|
|
export function checkNotNull(value: any, message?: string, callback?: ErrorCallback<IllegalValueError>): void;
|
|
export function checkNotNull(value: any, callback?: ErrorCallback<IllegalValueError>): void;
|