TagWithDecodingDefault & KindWithDecodingDefault
This commit is contained in:
12
package.json
12
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thilawyn/thilalib",
|
"name": "@thilawyn/thilalib",
|
||||||
"version": "0.1.13",
|
"version": "0.1.14",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"files": [
|
"files": [
|
||||||
"./dist"
|
"./dist"
|
||||||
@@ -70,16 +70,16 @@
|
|||||||
"type-fest": "^4.25.0"
|
"type-fest": "^4.25.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@effect/schema": "^0.71.0",
|
"@effect/schema": "^0.71.1",
|
||||||
"@types/jsonwebtoken": "^9.0.6",
|
"@types/jsonwebtoken": "^9.0.6",
|
||||||
"bun-types": "^1.1.24",
|
"bun-types": "^1.1.26",
|
||||||
"effect": "^3.6.4",
|
"effect": "^3.6.5",
|
||||||
"jsonwebtoken": "^9.0.2",
|
"jsonwebtoken": "^9.0.2",
|
||||||
"mobx": "^6.13.1",
|
"mobx": "^6.13.1",
|
||||||
"npm-check-updates": "^17.0.6",
|
"npm-check-updates": "^17.1.0",
|
||||||
"npm-sort": "^0.0.4",
|
"npm-sort": "^0.0.4",
|
||||||
"tsup": "^8.2.4",
|
"tsup": "^8.2.4",
|
||||||
"tsx": "^4.17.0",
|
"tsx": "^4.18.0",
|
||||||
"typescript": "^5.5.4"
|
"typescript": "^5.5.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,14 @@ import { Schema } from "@effect/schema"
|
|||||||
|
|
||||||
|
|
||||||
export const Kind = <Kind extends string>(kind: Kind) =>
|
export const Kind = <Kind extends string>(kind: Kind) =>
|
||||||
Schema.withConstructorDefault(
|
Schema.Literal(kind).pipe(
|
||||||
Schema.propertySignature(Schema.Literal(kind)),
|
Schema.propertySignature,
|
||||||
() => kind,
|
Schema.withConstructorDefault(() => kind),
|
||||||
|
)
|
||||||
|
|
||||||
|
export const KindWithDecodingDefault = <Kind extends string>(kind: Kind) =>
|
||||||
|
Schema.Literal(kind).pipe(
|
||||||
|
Schema.optional,
|
||||||
|
Schema.withConstructorDefault(() => kind),
|
||||||
|
Schema.withDecodingDefault(() => kind),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,7 +2,14 @@ import { Schema } from "@effect/schema"
|
|||||||
|
|
||||||
|
|
||||||
export const Tag = <Tag extends string>(tag: Tag) =>
|
export const Tag = <Tag extends string>(tag: Tag) =>
|
||||||
Schema.withConstructorDefault(
|
Schema.Literal(tag).pipe(
|
||||||
Schema.propertySignature(Schema.Literal(tag)),
|
Schema.propertySignature,
|
||||||
() => tag,
|
Schema.withConstructorDefault(() => tag),
|
||||||
|
)
|
||||||
|
|
||||||
|
export const TagWithDecodingDefault = <Tag extends string>(tag: Tag) =>
|
||||||
|
Schema.Literal(tag).pipe(
|
||||||
|
Schema.optional,
|
||||||
|
Schema.withConstructorDefault(() => tag),
|
||||||
|
Schema.withDecodingDefault(() => tag),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user