chenyc
2025-12-09 545c24c6a711d71b65f3d4e8122fee3837fb1edc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
export type EnsureFunction = (...args: any[]) => any;
export interface EnsureBaseOptions {
    name?: string;
    errorMessage?: string;
    errorCode?: number;
    Error?: ErrorConstructor;
}
 
export interface EnsureIsOptional {
    isOptional: boolean;
}
 
export interface EnsureDefault<T> {
    default: T;
}
 
type EnsureOptions = EnsureBaseOptions & { isOptional?: boolean } & { default?: any };
 
type ValidationDatum = [argumentName: string, inputValue: any, ensureFunction: EnsureFunction, options?: object];
type ValidationDatumList = ValidationDatum[];
 
declare function ensure<T>(...args: [...ValidationDatumList, EnsureOptions]): T;
declare function ensure<T>(...args: [...ValidationDatumList]): T;
export default ensure;