From b447cefad985f30c5e456237a43730b60424a52b Mon Sep 17 00:00:00 2001 From: mkrause Date: Fri, 13 Sep 2024 22:44:03 +0200 Subject: [PATCH] Fix example code in README. --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c025ca9..368d2be 100644 --- a/README.md +++ b/README.md @@ -153,11 +153,11 @@ type _CategoryEncoded = { }; export const Category = S.Struct({ name: S.String, - subcategories: S.optional( - S.Record( - S.String, - S.suspend((): S.Schema<_Category, _CategoryEncoded> => Category), - ), + subcategories: S.optionalWith( + S.Record({ + key: S.String, + value: S.suspend((): S.Schema<_Category, _CategoryEncoded> => Category), + }), { default: () => ({}), }, @@ -180,7 +180,7 @@ export const User = S.Struct({ * - AUDITOR: Read only permissions */ role: S.Literal('ADMIN', 'USER', 'AUDITOR'), // The user's role within the system. - interests: S.optional(S.Array(Category), { + interests: S.optionalWith(S.Array(Category), { default: () => [], }), }).annotations({ identifier: 'User' });