amberflo-metering-typescript
Version:
Amberflo metering client for TypeScript
36 lines (35 loc) • 1.69 kB
TypeScript
export interface IValidatable {
validate(): void;
}
export interface INestedValidatable {
validate(prefix: string): void;
}
declare function required<TValue>(name: string, value: TValue | null | undefined): value is TValue;
declare function valid(name: string, value: INestedValidatable | null | undefined, nullable?: boolean): void;
declare function positiveInteger(name: string, value: number | null | undefined, nullable?: boolean): void;
declare function positiveNumber(name: string, value: number | null | undefined, nullable?: boolean): void;
declare function nonEmptyStr(name: string, value: string | null | undefined, nullable?: boolean): void;
declare function nonEmptyStrMap(name: string, value: {
[key: string]: string;
} | null | undefined, nullable?: boolean): void;
declare function nonEmptyList(name: string, value: string[] | null | undefined, nullable?: boolean): void;
declare function nonEmptyListMap(name: string, value: {
[key: string]: string[];
} | null | undefined, nullable?: boolean): void;
export declare const validators: {
required: typeof required;
valid: typeof valid;
positiveInteger: typeof positiveInteger;
positiveNumber: typeof positiveNumber;
nonEmptyStr: typeof nonEmptyStr;
nonEmptyStrMap: typeof nonEmptyStrMap;
nonEmptyList: typeof nonEmptyList;
nonEmptyListMap: typeof nonEmptyListMap;
};
/**
* Use this function on backwards compatible constructors that used to be
* called without arguments. `value` should be the value of the last mandatory
* parameter.
*/
export declare function maybeShowDeprecationWarning<TValue>(typeName: string, value: TValue | null | undefined): void;
export {};