@effect/schema
Advanced tools
Comparing version 0.8.0 to 0.8.1
@@ -879,3 +879,3 @@ "use strict"; | ||
case "Refinement": | ||
return _getParameterKeyof(ast.from); | ||
return _getParameterKeyof(ast.to); | ||
} | ||
@@ -934,3 +934,3 @@ return neverKeyword; | ||
case "Refinement": | ||
return _getPropertySignatures(ast.from); | ||
return _getPropertySignatures(ast.to); | ||
case "Transform": | ||
@@ -937,0 +937,0 @@ throw new Error("cannot compute property signatures for transformations"); |
{ | ||
"name": "@effect/schema", | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -242,3 +242,3 @@ /** | ||
[K in keyof A]: A[K]; | ||
} extends infer B ? B : never; | ||
} & {}; | ||
/** | ||
@@ -274,3 +274,3 @@ * @since 1.0.0 | ||
*/ | ||
export declare const struct: <Fields extends Record<PropertyKey, Schema<any, any> | OptionalSchema<any, any>>>(fields: Fields) => Schema<Spread<{ readonly [K in Exclude<keyof Fields, OptionalKeys<Fields>>]: From<Fields[K]>; } & { readonly [K_1 in OptionalKeys<Fields>]?: From<Fields[K_1]>; }>, Spread<{ readonly [K_2 in Exclude<keyof Fields, OptionalKeys<Fields>>]: To<Fields[K_2]>; } & { readonly [K_3 in OptionalKeys<Fields>]?: To<Fields[K_3]>; }>>; | ||
export declare const struct: <Fields extends Record<PropertyKey, Schema<any, any> | OptionalSchema<any, any>>>(fields: Fields) => Schema<{ readonly [K in Exclude<keyof Fields, OptionalKeys<Fields>>]: From<Fields[K]>; } & { readonly [K_1 in OptionalKeys<Fields>]?: From<Fields[K_1]>; } extends infer T ? { [K_4 in keyof T]: ({ readonly [K in Exclude<keyof Fields, OptionalKeys<Fields>>]: From<Fields[K]>; } & { readonly [K_1 in OptionalKeys<Fields>]?: From<Fields[K_1]>; })[K_4]; } : never, { readonly [K_2 in Exclude<keyof Fields, OptionalKeys<Fields>>]: To<Fields[K_2]>; } & { readonly [K_3 in OptionalKeys<Fields>]?: To<Fields[K_3]>; } extends infer T_1 ? { [K_5 in keyof T_1]: ({ readonly [K_2 in Exclude<keyof Fields, OptionalKeys<Fields>>]: To<Fields[K_2]>; } & { readonly [K_3 in OptionalKeys<Fields>]?: To<Fields[K_3]>; })[K_5]; } : never>; | ||
/** | ||
@@ -342,3 +342,3 @@ * @category combinators | ||
*/ | ||
export declare const partial: <I, A>(self: Schema<I, A>) => Schema<Spread<Partial<I>>, Spread<Partial<A>>>; | ||
export declare const partial: <I, A>(self: Schema<I, A>) => Schema<Partial<I> extends infer T ? { [K in keyof T]: Partial<I>[K]; } : never, Partial<A> extends infer T_1 ? { [K_1 in keyof T_1]: Partial<A>[K_1]; } : never>; | ||
/** | ||
@@ -348,3 +348,3 @@ * @category combinators | ||
*/ | ||
export declare const required: <I, A>(self: Schema<I, A>) => Schema<Spread<Required<I>>, Spread<Required<A>>>; | ||
export declare const required: <I, A>(self: Schema<I, A>) => Schema<Required<I> extends infer T ? { [K in keyof T]: Required<I>[K]; } : never, Required<A> extends infer T_1 ? { [K_1 in keyof T_1]: Required<A>[K_1]; } : never>; | ||
/** | ||
@@ -359,3 +359,3 @@ * @category combinators | ||
*/ | ||
export declare const extend: <IB, B>(that: Schema<IB, B>) => <I, A>(self: Schema<I, A>) => Schema<Spread<I & IB>, Spread<A & B>>; | ||
export declare const extend: <IB, B>(that: Schema<IB, B>) => <I, A>(self: Schema<I, A>) => Schema<I & IB extends infer T ? { [K in keyof T]: (I & IB)[K]; } : never, A & B extends infer T_1 ? { [K_1 in keyof T_1]: (A & B)[K_1]; } : never>; | ||
/** | ||
@@ -386,4 +386,4 @@ * @category combinators | ||
*/ | ||
export declare function filter<A, B extends A>(refinement: Refinement<A, B>, options?: AnnotationOptions<A>): <I>(self: Schema<I, A>) => Schema<I, B>; | ||
export declare function filter<A>(predicate: Predicate<A>, options?: AnnotationOptions<A>): <I>(self: Schema<I, A>) => Schema<I, A>; | ||
export declare function filter<C extends A, B extends A, A = C>(refinement: Refinement<A, B>, options?: AnnotationOptions<A>): <I>(self: Schema<I, C>) => Schema<I, Spread<C & B>>; | ||
export declare function filter<B extends A, A = B>(predicate: Predicate<A>, options?: AnnotationOptions<A>): <I>(self: Schema<I, B>) => Schema<I, B>; | ||
/** | ||
@@ -439,3 +439,3 @@ Create a new `Schema` by transforming the input and output of an existing `Schema` | ||
*/ | ||
export declare const attachPropertySignature: <K extends PropertyKey, V extends AST.LiteralValue>(key: K, value: V) => <I, A extends object>(schema: Schema<I, A>) => Schema<I, Spread<A & { readonly [k in K]: V; }>>; | ||
export declare const attachPropertySignature: <K extends PropertyKey, V extends AST.LiteralValue>(key: K, value: V) => <I, A extends object>(schema: Schema<I, A>) => Schema<I, A & { readonly [k in K]: V; } extends infer T ? { [K_1 in keyof T]: (A & { readonly [k in K]: V; })[K_1]; } : never>; | ||
/** | ||
@@ -870,3 +870,3 @@ * @category combinators | ||
*/ | ||
export declare const optionsFromOptionals: <Fields extends Record<PropertyKey, Schema<any, any>>>(fields: Fields) => <I, A extends object>(schema: Schema<I, A>) => Schema<Spread<I & { readonly [K in keyof Fields]?: From<Fields[K]>; }>, Spread<A & { readonly [K_1 in keyof Fields]: Option<To<Fields[K_1]>>; }>>; | ||
export declare const optionsFromOptionals: <Fields extends Record<PropertyKey, Schema<any, any>>>(fields: Fields) => <I, A extends object>(schema: Schema<I, A>) => Schema<I & { readonly [K in keyof Fields]?: From<Fields[K]>; } extends infer T ? { [K_2 in keyof T]: (I & { readonly [K in keyof Fields]?: From<Fields[K]>; })[K_2]; } : never, A & { readonly [K_1 in keyof Fields]: Option<To<Fields[K_1]>>; } extends infer T_1 ? { [K_3 in keyof T_1]: (A & { readonly [K_1 in keyof Fields]: Option<To<Fields[K_1]>>; })[K_3]; } : never>; | ||
/** | ||
@@ -873,0 +873,0 @@ * @since 1.0.0 |
@@ -1337,3 +1337,3 @@ /** | ||
case "Refinement": | ||
return _getParameterKeyof(ast.from) | ||
return _getParameterKeyof(ast.to) | ||
} | ||
@@ -1408,3 +1408,3 @@ return neverKeyword | ||
case "Refinement": | ||
return _getPropertySignatures(ast.from) | ||
return _getPropertySignatures(ast.to) | ||
case "Transform": | ||
@@ -1411,0 +1411,0 @@ throw new Error("cannot compute property signatures for transformations") |
@@ -416,5 +416,3 @@ /** | ||
*/ | ||
export type Spread<A> = { | ||
[K in keyof A]: A[K] | ||
} extends infer B ? B : never | ||
export type Spread<A> = { [K in keyof A]: A[K] } & {} | ||
@@ -742,10 +740,10 @@ /** | ||
*/ | ||
export function filter<A, B extends A>( | ||
export function filter<C extends A, B extends A, A = C>( | ||
refinement: Refinement<A, B>, | ||
options?: AnnotationOptions<A> | ||
): <I>(self: Schema<I, A>) => Schema<I, B> | ||
export function filter<A>( | ||
): <I>(self: Schema<I, C>) => Schema<I, Spread<C & B>> | ||
export function filter<B extends A, A = B>( | ||
predicate: Predicate<A>, | ||
options?: AnnotationOptions<A> | ||
): <I>(self: Schema<I, A>) => Schema<I, A> | ||
): <I>(self: Schema<I, B>) => Schema<I, B> | ||
export function filter<A>( | ||
@@ -752,0 +750,0 @@ predicate: Predicate<A>, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
844794
16078