validation.ts
Advanced tools
Comparing version 0.0.20 to 0.0.21
@@ -87,4 +87,12 @@ import { Result, Ok, Err, Option, None, Some } from 'space-lift'; | ||
export declare type Props = Record<string, Any>; | ||
declare type OptionalKeys<P extends Props> = { | ||
[K in keyof P]: undefined extends TypeOf<P[K]> ? K : never; | ||
}[keyof P]; | ||
declare type MandatoryKeys<P extends Props> = { | ||
[K in keyof P]: undefined extends TypeOf<P[K]> ? never : K; | ||
}[keyof P]; | ||
export declare type ObjectOf<P extends Props> = { | ||
[K in keyof P]: TypeOf<P[K]>; | ||
[K in MandatoryKeys<P>]: TypeOf<P[K]>; | ||
} & { | ||
[K in OptionalKeys<P>]?: TypeOf<P[K]>; | ||
}; | ||
@@ -91,0 +99,0 @@ export declare class ObjectValidator<P extends Props> extends Validator<ObjectOf<P>> { |
@@ -87,4 +87,12 @@ import { Result, Ok, Err, Option, None, Some } from 'space-lift'; | ||
export declare type Props = Record<string, Any>; | ||
declare type OptionalKeys<P extends Props> = { | ||
[K in keyof P]: undefined extends TypeOf<P[K]> ? K : never; | ||
}[keyof P]; | ||
declare type MandatoryKeys<P extends Props> = { | ||
[K in keyof P]: undefined extends TypeOf<P[K]> ? never : K; | ||
}[keyof P]; | ||
export declare type ObjectOf<P extends Props> = { | ||
[K in keyof P]: TypeOf<P[K]>; | ||
[K in MandatoryKeys<P>]: TypeOf<P[K]>; | ||
} & { | ||
[K in OptionalKeys<P>]?: TypeOf<P[K]>; | ||
}; | ||
@@ -91,0 +99,0 @@ export declare class ObjectValidator<P extends Props> extends Validator<ObjectOf<P>> { |
{ | ||
"name": "validation.ts", | ||
"version": "0.0.20", | ||
"version": "0.0.21", | ||
"description": "Validation for TypeScript", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
74678
1469