diff --git a/bun.lockb b/bun.lockb index 8243ed5..5ff5c9a 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 9e53189..7600ee7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@thilawyn/thilalib", - "version": "0.1.13", + "version": "0.1.14", "type": "module", "files": [ "./dist" @@ -70,16 +70,16 @@ "type-fest": "^4.25.0" }, "devDependencies": { - "@effect/schema": "^0.71.0", + "@effect/schema": "^0.71.1", "@types/jsonwebtoken": "^9.0.6", - "bun-types": "^1.1.24", - "effect": "^3.6.4", + "bun-types": "^1.1.26", + "effect": "^3.6.5", "jsonwebtoken": "^9.0.2", "mobx": "^6.13.1", - "npm-check-updates": "^17.0.6", + "npm-check-updates": "^17.1.0", "npm-sort": "^0.0.4", "tsup": "^8.2.4", - "tsx": "^4.17.0", + "tsx": "^4.18.0", "typescript": "^5.5.4" } } diff --git a/src/Schema/Kind.ts b/src/Schema/Kind.ts index 5f4b88b..8f6e323 100644 --- a/src/Schema/Kind.ts +++ b/src/Schema/Kind.ts @@ -2,7 +2,14 @@ import { Schema } from "@effect/schema" export const Kind = (kind: Kind) => - Schema.withConstructorDefault( - Schema.propertySignature(Schema.Literal(kind)), - () => kind, + Schema.Literal(kind).pipe( + Schema.propertySignature, + Schema.withConstructorDefault(() => kind), + ) + +export const KindWithDecodingDefault = (kind: Kind) => + Schema.Literal(kind).pipe( + Schema.optional, + Schema.withConstructorDefault(() => kind), + Schema.withDecodingDefault(() => kind), ) diff --git a/src/Schema/Tag.ts b/src/Schema/Tag.ts index 2181b7a..0425ae5 100644 --- a/src/Schema/Tag.ts +++ b/src/Schema/Tag.ts @@ -2,7 +2,14 @@ import { Schema } from "@effect/schema" export const Tag = (tag: Tag) => - Schema.withConstructorDefault( - Schema.propertySignature(Schema.Literal(tag)), - () => tag, + Schema.Literal(tag).pipe( + Schema.propertySignature, + Schema.withConstructorDefault(() => tag), + ) + +export const TagWithDecodingDefault = (tag: Tag) => + Schema.Literal(tag).pipe( + Schema.optional, + Schema.withConstructorDefault(() => tag), + Schema.withDecodingDefault(() => tag), )