import * as check from "../../../../generated/sync/check/dictionary-of/date"; import {AssertError} from "../../../../sync/error/AssertError"; export function assertDictionaryOfPotentiallyUnsafeDate (name : string, mixed : any) : ({ [key : string] : Date })|never { const error = check.checkDictionaryOfPotentiallyUnsafeDate(mixed); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed); } } export function assertDictionaryOfValidDate (name : string, mixed : any) : ({ [key : string] : Date })|never { const error = check.checkDictionaryOfValidDate(mixed); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed); } } export function assertDictionaryOfBefore (name : string, mixed : any, x : Date) : ({ [key : string] : Date })|never { const error = check.checkDictionaryOfBefore(mixed, x); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed, x); } } export function assertDictionaryOfBeforeHandler (x : Date) : (name : string, mixed : any) => ({ [key : string] : Date })|never { return (name : string, mixed : any) : ({ [key : string] : Date })|never => { return assertDictionaryOfBefore(name, mixed, x); }; } export function assertDictionaryOfAfter (name : string, mixed : any, x : Date) : ({ [key : string] : Date })|never { const error = check.checkDictionaryOfAfter(mixed, x); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed, x); } } export function assertDictionaryOfAfterHandler (x : Date) : (name : string, mixed : any) => ({ [key : string] : Date })|never { return (name : string, mixed : any) : ({ [key : string] : Date })|never => { return assertDictionaryOfAfter(name, mixed, x); }; } export function assertDictionaryOfBeforeOrAt (name : string, mixed : any, x : Date) : ({ [key : string] : Date })|never { const error = check.checkDictionaryOfBeforeOrAt(mixed, x); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed, x); } } export function assertDictionaryOfBeforeOrAtHandler (x : Date) : (name : string, mixed : any) => ({ [key : string] : Date })|never { return (name : string, mixed : any) : ({ [key : string] : Date })|never => { return assertDictionaryOfBeforeOrAt(name, mixed, x); }; } export function assertDictionaryOfAfterOrAt (name : string, mixed : any, x : Date) : ({ [key : string] : Date })|never { const error = check.checkDictionaryOfAfterOrAt(mixed, x); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed, x); } } export function assertDictionaryOfAfterOrAtHandler (x : Date) : (name : string, mixed : any) => ({ [key : string] : Date })|never { return (name : string, mixed : any) : ({ [key : string] : Date })|never => { return assertDictionaryOfAfterOrAt(name, mixed, x); }; } export function assertDictionaryOfRange (name : string, mixed : any, args : { min? : Date, max? : Date }) : ({ [key : string] : Date })|never { const error = check.checkDictionaryOfRange(mixed, args); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed, args); } } export function assertDictionaryOfRangeHandler (args : { min? : Date, max? : Date }) : (name : string, mixed : any) => ({ [key : string] : Date })|never { return (name : string, mixed : any) : ({ [key : string] : Date })|never => { return assertDictionaryOfRange(name, mixed, args); }; }