Skip to content

Commit

Permalink
fix(schema): struct optional property derivation
Browse files Browse the repository at this point in the history
  • Loading branch information
0x706b committed May 20, 2024
1 parent eb93279 commit 6a8cea5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/breezy-moles-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@fncts/schema": patch
---

fix: struct optional property derivation
2 changes: 1 addition & 1 deletion packages/schema/src/Schema/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ export const implicitDate: Schema<Date> = Schema.unknown.transformOrFail(
);

/**
* @tsplus static fncts.schema.SchemaOps union
* @tsplus derive fncts.schema.Schema<|> 30
* @tsplus static fncts.schema.SchemaOps union
*/
export function union<A extends ReadonlyArray<unknown>>(
...members: {
Expand Down
2 changes: 1 addition & 1 deletion packages/schema/src/Schema/derivations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function deriveStruct<A extends Record<string, any>>(
? [optionalFields: {}]
: [
optionalFields: {
[k in OptionalKeys<A>]: Schema<NonNullable<A[k]>>;
[k in OptionalKeys<A>]: Schema<A[k]>;
},
]),
...([MaybeKeys<A>] extends [never]
Expand Down

0 comments on commit 6a8cea5

Please sign in to comment.