Patch Changes
-
#3359
7c0da50
Thanks @gcanti! - AddContext
field toSchema
interface, closes #3356 -
#3363
2fc0ff4
Thanks @gcanti! - exportisPropertySignature
guard -
#3357
f262665
Thanks @gcanti! - Improve annotation retrieval fromClass
APIs, closes #3348.Previously, accessing annotations such as
identifier
andtitle
required explicit casting of theast
field toAST.Transformation
.
This update refines the type definitions to reflect thatast
is always anAST.Transformation
, eliminating the need for casting and simplifying client code.import { AST, Schema } from "@effect/schema"; class Person extends Schema.Class<Person>("Person")( { name: Schema.String, age: Schema.Number, }, { description: "my description" }, ) {} console.log(AST.getDescriptionAnnotation(Person.ast.to)); // { _id: 'Option', _tag: 'Some', value: 'my description' }
-
#3343
9bbe7a6
Thanks @gcanti! - - addNonEmptyTrimmedString
Example
import { Schema } from "@effect/schema"; console.log(Schema.decodeOption(Schema.NonEmptyTrimmedString)("")); // Option.none() console.log(Schema.decodeOption(Schema.NonEmptyTrimmedString)(" a ")); // Option.none() console.log(Schema.decodeOption(Schema.NonEmptyTrimmedString)("a")); // Option.some("a")
-
add
OptionFromNonEmptyTrimmedString
, closes #3335Example
import { Schema } from "@effect/schema"; console.log(Schema.decodeSync(Schema.OptionFromNonEmptyTrimmedString)("")); // Option.none() console.log( Schema.decodeSync(Schema.OptionFromNonEmptyTrimmedString)(" a "), ); // Option.some("a") console.log(Schema.decodeSync(Schema.OptionFromNonEmptyTrimmedString)("a")); // Option.some("a")
-
-
Updated dependencies [
6359644
,7f41e42
,f566fd1
]:- effect@3.5.9