diff --git a/package.json b/package.json index 4eead09fd5..2ce844fe39 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "rollup-plugin-bundle-stats": "^4.19.1", "rollup-plugin-esbuild": "^6.2.1", "terser": "^5.39.0", - "tstyche": "4.0.0-rc.0", + "tstyche": "4.0.0", "tsx": "^4.17.0", "typescript": "^5.7.2", "typescript-eslint": "^8.31.1", diff --git a/packages/effect/SCHEMA.md b/packages/effect/SCHEMA.md index a271a82342..b248783a26 100644 --- a/packages/effect/SCHEMA.md +++ b/packages/effect/SCHEMA.md @@ -269,13 +269,95 @@ encode(schema) = decode(flip(schema)) ## Constructors Redesign -### Keeping Constructors in Composed Schemas +### Constructors in Composed Schemas -To support constructors in composed schemas, `makeSync` will be added to the base `Bottom` type. +To support constructing values from composed schemas, `makeSync` is now available on all schemas, including unions. -### Constructor Default Values +```ts +import { Schema } from "effect" -A constructor default allows a schema to generate a value when one is not provided. +const schema = Schema.Union([ + Schema.Struct({ a: Schema.String }), + Schema.Struct({ b: Schema.Number }) +]) + +schema.makeSync({ a: "hello" }) +schema.makeSync({ b: 1 }) +``` + +### Branded Constructors + +For branded schemas, the default constructor accepts an unbranded input and returns a branded output. + +```ts +import { Schema } from "effect" + +const schema = Schema.String.pipe(Schema.brand("a")) + +// makeSync(input: string, options?: Schema.MakeOptions): string & Brand<"a"> +schema.makeSync +``` + +However, when a branded schema is part of a composite (such as a struct), you must pass a branded value. + +```ts +import { Schema } from "effect" + +const schema = Schema.Struct({ + a: Schema.String.pipe(Schema.brand("a")), + b: Schema.Number +}) + +/* +makeSync(input: { + readonly a: string & Brand<"a">; + readonly b: number; +}, options?: Schema.MakeOptions): { + readonly a: string & Brand<"a">; + readonly b: number; +} +*/ +schema.makeSync +``` + +### Refined Constructors + +For refined schemas, the constructor accepts the unrefined type and returns the refined one. + +```ts +import { Option, Schema } from "effect" + +const schema = Schema.Option(Schema.String).pipe(Schema.guard(Option.isSome)) + +// makeSync(input: Option.Option, options?: Schema.MakeOptions): Option.Some +schema.makeSync +``` + +As with branding, when used in a composite schema, the refined value must be provided. + +```ts +import { Option, Schema } from "effect" + +const schema = Schema.Struct({ + a: Schema.Option(Schema.String).pipe(Schema.guard(Option.isSome)), + b: Schema.Number +}) + +/* +makeSync(input: { + readonly a: Option.Some; + readonly b: number; +}, options?: Schema.MakeOptions): { + readonly a: Option.Some; + readonly b: number; +} +*/ +schema.makeSync +``` + +### Default Values in Constructors + +You can define a default value for a field using `Schema.withConstructorDefault`. If no value is provided at runtime, the constructor uses this default. **Example** (Providing a default number) @@ -313,7 +395,7 @@ console.log(schema.makeSync({})) // { a: 2025-05-19T16:46:10.913Z } ``` -If the function returns `Option.none()`, it means no default value was provided, and the field is considered missing. +If the default function returns `Option.none()`, it means no default value was provided, and the field is considered missing. **Example** (Returning `None` to skip a default) @@ -350,7 +432,30 @@ try { // { a: 2025-05-19T16:48:41.948Z } ``` -#### Effectful Defaults +#### Nested Constructor Default Values + +Default values can be nested inside composed schemas. In this case, inner defaults are resolved first. + +**Example** (Nested default values) + +```ts +import { Result, Schema } from "effect" + +const schema = Schema.Struct({ + a: Schema.Struct({ + b: Schema.Number.pipe( + Schema.withConstructorDefault(() => Result.succeedSome(-1)) + ) + }).pipe(Schema.withConstructorDefault(() => Result.succeedSome({}))) +}) + +console.log(schema.makeSync({})) +// { a: { b: -1 } } +console.log(schema.makeSync({ a: {} })) +// { a: { b: -1 } } +``` + +### Effectful Defaults Default values can also be computed using effects, as long as the environment is `never`. @@ -412,29 +517,6 @@ SchemaResult.asEffect(schema.make({})) // { a: -1 } ``` -### Nested Constructor Default Values - -Default values can be nested inside composed schemas. In this case, inner defaults are resolved first. - -**Example** (Nested default values) - -```ts -import { Result, Schema } from "effect" - -const schema = Schema.Struct({ - a: Schema.Struct({ - b: Schema.Number.pipe( - Schema.withConstructorDefault(() => Result.succeedSome(-1)) - ) - }).pipe(Schema.withConstructorDefault(() => Result.succeedSome({}))) -}) - -console.log(schema.makeSync({})) -// { a: { b: -1 } } -console.log(schema.makeSync({ a: {} })) -// { a: { b: -1 } } -``` - ## Filters Redesign Filters are applied using the either the `.check` method or the `Schema.check` function. diff --git a/packages/effect/dtslint/Schema.tst.ts b/packages/effect/dtslint/Schema.tst.ts index ebd0a21f8c..1173c666c2 100644 --- a/packages/effect/dtslint/Schema.tst.ts +++ b/packages/effect/dtslint/Schema.tst.ts @@ -12,6 +12,8 @@ import { } from "effect" import { describe, expect, it, when } from "tstyche" +type MakeSync = (input: In, options?: Schema.MakeOptions | undefined) => Out + const revealClass = , Inherited>( klass: Schema.Class ): Schema.Class => klass @@ -68,70 +70,332 @@ describe("Schema", () => { describe("makeSync", () => { it("Never", () => { const schema = Schema.Never - expect(schema.makeSync).type.toBe<(input: never, options?: Schema.MakeOptions | undefined) => never>() + expect(schema.makeSync).type.toBe>() }) it("Unknown", () => { const schema = Schema.Unknown - expect(schema.makeSync).type.toBe<(input: unknown, options?: Schema.MakeOptions | undefined) => unknown>() + expect(schema.makeSync).type.toBe>() + }) + + it("Any", () => { + const schema = Schema.Any + expect(schema.makeSync).type.toBe>() }) it("Null", () => { const schema = Schema.Null - expect(schema.makeSync).type.toBe<(input: null, options?: Schema.MakeOptions | undefined) => null>() + expect(schema.makeSync).type.toBe>() }) it("Undefined", () => { const schema = Schema.Undefined - expect(schema.makeSync).type.toBe<(input: undefined, options?: Schema.MakeOptions | undefined) => undefined>() + expect(schema.makeSync).type.toBe>() }) it("String", () => { const schema = Schema.String - expect(schema.makeSync).type.toBe<(input: string, options?: Schema.MakeOptions | undefined) => string>() + expect(schema.makeSync).type.toBe>() }) it("Number", () => { const schema = Schema.Number - expect(schema.makeSync).type.toBe<(input: number, options?: Schema.MakeOptions | undefined) => number>() + expect(schema.makeSync).type.toBe>() }) it("check", () => { const schema = Schema.String.check(SchemaCheck.minLength(1)) - expect(schema.makeSync).type.toBe<(input: string, options?: Schema.MakeOptions | undefined) => string>() + expect(schema.makeSync).type.toBe>() }) it("brand", () => { const schema = Schema.String.pipe(Schema.brand("a")) + expect(schema.makeSync).type.toBe>>() + }) + + it("guard", () => { + const schema = Schema.Option(Schema.String).pipe(Schema.guard(Option.isSome)) + expect(schema.makeSync).type.toBe, Option.Some>>() + }) + + describe("Struct", () => { + it("simple field", () => { + const schema = Schema.Struct({ + a: Schema.String + }) + expect(schema.makeSync).type.toBe>() + }) + + it("branded field", () => { + const schema = Schema.Struct({ + a: Schema.String.pipe(Schema.brand("a")) + }) + expect(schema.makeSync).type.toBe< + MakeSync<{ readonly a: string & Brand.Brand<"a"> }, { readonly a: string & Brand.Brand<"a"> }> + >() + }) + + it("guarded field", () => { + const schema = Schema.Struct({ + a: Schema.Option(Schema.String).pipe(Schema.guard(Option.isSome)) + }) + expect(schema.makeSync).type.toBe< + MakeSync<{ readonly a: Option.Some }, { readonly a: Option.Some }> + >() + }) + + it("defaulted field", () => { + const schema = Schema.Struct({ + a: Schema.String.pipe(Schema.withConstructorDefault(() => Option.some("default"))) + }) + expect(schema.makeSync).type.toBe>() + }) + + it("branded defaulted field", () => { + const schema = Schema.Struct({ + a: Schema.String.pipe(Schema.brand("a"), Schema.withConstructorDefault(() => Option.some("default"))) + }) + expect(schema.makeSync).type.toBe< + MakeSync<{ readonly a?: string & Brand.Brand<"a"> }, { readonly a: string & Brand.Brand<"a"> }> + >() + }) + + it("defaulted branded field", () => { + const schema = Schema.Struct({ + a: Schema.String.pipe(Schema.withConstructorDefault(() => Option.some("default")), Schema.brand("a")) + }) + expect(schema.makeSync).type.toBe< + MakeSync<{ readonly a?: string & Brand.Brand<"a"> }, { readonly a: string & Brand.Brand<"a"> }> + >() + }) + + it("nested defaulted fields", () => { + const schema = Schema.Struct({ + a: Schema.Struct({ + b: Schema.Finite.pipe(Schema.withConstructorDefault(() => Option.some(-1))) + }).pipe(Schema.withConstructorDefault(() => Option.some({}))) + }) + expect(schema.makeSync).type.toBe< + MakeSync<{ readonly a?: { readonly b?: number } }, { readonly a: { readonly b: number } }> + >() + }) + + it("nested defaulted & branded field", () => { + const A = Schema.Struct({ + b: Schema.Finite.pipe(Schema.withConstructorDefault(() => Option.some(-1))) + }).pipe(Schema.brand("a")) + const schema = Schema.Struct({ + a: A.pipe(Schema.withConstructorDefault(() => Option.some(A.makeSync({})))) + }) + expect(schema.makeSync).type.toBe< + MakeSync< + { readonly a?: { readonly b: number } & Brand.Brand<"a"> }, + { readonly a: { readonly b: number } & Brand.Brand<"a"> } + > + >() + }) + + it("Class field", () => { + class A extends Schema.Class("A")(Schema.Struct({ + a: Schema.String + })) {} + const schema = Schema.Struct({ + a: A + }) + expect(schema.makeSync).type.toBe>() + }) + + it("optional Class field", () => { + class A extends Schema.Class("A")(Schema.Struct({ + a: Schema.String + })) {} + const schema = Schema.Struct({ + a: A.pipe(Schema.withConstructorDefault(() => Option.some(new A({ a: "default" })))) + }) + expect(schema.makeSync).type.toBe>() + }) + }) + + describe("Tuple", () => { + it("simple element", () => { + const schema = Schema.Tuple([Schema.String]) + expect(schema.makeSync).type.toBe>() + }) + + it("branded field", () => { + const schema = Schema.Tuple([Schema.String.pipe(Schema.brand("a"))]) + expect(schema.makeSync).type.toBe< + MakeSync], readonly [string & Brand.Brand<"a">]> + >() + }) + + it("defaulted field", () => { + const schema = Schema.Tuple([Schema.String.pipe(Schema.withConstructorDefault(() => Option.some("default")))]) + expect(schema.makeSync).type.toBe>() + }) + + it("nested defaults (Struct)", () => { + const schema = Schema.Tuple( + [ + Schema.Struct({ + b: Schema.FiniteFromString.pipe(Schema.withConstructorDefault(() => Option.some(-1))) + }).pipe(Schema.withConstructorDefault(() => Option.some({}))) + ] + ) + expect(schema.makeSync).type.toBe< + MakeSync + >() + }) + + it("nested defaults (Tuple)", () => { + const schema = Schema.Tuple( + [ + Schema.Tuple([ + Schema.FiniteFromString.pipe(Schema.withConstructorDefault(() => Option.some(-1))) + ]).pipe(Schema.withConstructorDefault(() => Option.some([] as const))) + ] + ) + expect(schema.makeSync).type.toBe>() + }) + }) + + describe("Class", () => { + it("nested defaulted fields", () => { + class A extends Schema.Class("A")(Schema.Struct({ + a: Schema.Struct({ + b: Schema.Finite.pipe(Schema.withConstructorDefault(() => Option.some(-1))) + }).pipe(Schema.withConstructorDefault(() => Option.some({}))) + })) {} + expect(A.makeSync).type.toBe>() + const schema = Schema.Struct({ + a: A + }) + expect(schema.makeSync).type.toBe>() + }) + }) + + it("typeCodec", () => { + const schema = Schema.typeCodec(Schema.FiniteFromString) + expect(schema.makeSync).type.toBe>() + }) + + it("encodedCodec", () => { + const schema = Schema.encodedCodec(Schema.FiniteFromString) + expect(schema.makeSync).type.toBe>() + }) + + it("flip", () => { + const schema = Schema.Struct({ + a: Schema.FiniteFromString + }) + const flipped = Schema.flip(schema) + expect(flipped.makeSync).type.toBe>() + }) + + it("Array", () => { + const schema = Schema.Array(Schema.FiniteFromString.pipe(Schema.brand("a"))) expect(schema.makeSync).type.toBe< - (input: string, options?: Schema.MakeOptions | undefined) => string & Brand.Brand<"a"> + MakeSync>, ReadonlyArray>> >() }) - it("Struct", () => { - const schema = Schema.Struct({ - a: Schema.String.pipe(Schema.brand("a")) - }) + it("Record", () => { + const schema = Schema.Record( + Schema.String.pipe(Schema.brand("k")), + Schema.FiniteFromString.pipe(Schema.brand("a")) + ) + expect(schema.makeSync).type.toBe< - ( - input: { readonly a: string }, - options?: Schema.MakeOptions | undefined - ) => { readonly a: string & Brand.Brand<"a"> } + MakeSync< + { readonly [x: string & Brand.Brand<"k">]: number & Brand.Brand<"a"> }, + { readonly [x: string & Brand.Brand<"k">]: number & Brand.Brand<"a"> } + > + >() + }) + + it("StructWithRest", () => { + const schema = Schema.StructWithRest( + Schema.Struct({ a: Schema.FiniteFromString.pipe(Schema.brand("a")) }), + [Schema.Record(Schema.String.pipe(Schema.brand("k")), Schema.FiniteFromString.pipe(Schema.brand("a")))] + ) + expect(schema.makeSync).type.toBe< + MakeSync<{ + readonly [x: string & Brand.Brand<"k">]: number & Brand.Brand<"a"> + readonly a: number & Brand.Brand<"a"> + }, { + readonly [x: string & Brand.Brand<"k">]: number & Brand.Brand<"a"> + readonly a: number & Brand.Brand<"a"> + }> + >() + }) + + it("TupleWithRest", () => { + const schema = Schema.TupleWithRest( + Schema.Tuple([Schema.FiniteFromString.pipe(Schema.brand("a"))]), + [Schema.FiniteFromString.pipe(Schema.brand("b")), Schema.FiniteFromString.pipe(Schema.brand("c"))] + ) + expect(schema.makeSync).type.toBe< + MakeSync< + readonly [number & Brand.Brand<"a">, ...Array>, number & Brand.Brand<"c">], + readonly [number & Brand.Brand<"a">, ...Array>, number & Brand.Brand<"c">] + > + >() + }) + + it("Union", () => { + const schema = Schema.Union([ + Schema.Array(Schema.FiniteFromString.pipe(Schema.brand("a"))), + Schema.FiniteFromString.pipe(Schema.brand("b")) + ]) + expect(schema.makeSync).type.toBe< + MakeSync< + ReadonlyArray> | number & Brand.Brand<"b">, + ReadonlyArray> | number & Brand.Brand<"b"> + > + >() + }) + + it("Opaque", () => { + class A extends Schema.Opaque()( + Schema.Struct({ + b: Schema.FiniteFromString.pipe(Schema.brand("a"), Schema.withConstructorDefault(() => Option.some(-1))) + }) + ) {} + const schema = Schema.Struct({ + a: A + }) + + expect(schema.makeSync).type.toBe< + MakeSync<{ readonly a: { readonly b?: number & Brand.Brand<"a"> } }, { readonly a: A }> >() }) }) - describe("typeSchema", () => { + describe("typeCodec", () => { it("ast type", () => { - const schema = Schema.String.pipe(Schema.brand("a"), Schema.typeCodec) - expect(schema.ast).type.toBe() + const schema = Schema.typeCodec(Schema.FiniteFromString) + expect(schema.ast).type.toBe() }) - it("typeSchema", () => { - const schema = Schema.String.pipe(Schema.brand("a"), Schema.typeCodec) - expect(schema.makeSync).type.toBe< - (input: string, options?: Schema.MakeOptions | undefined) => string & Brand.Brand<"a"> - >() + it("revealCodec + annotate", () => { + const schema = Schema.typeCodec(Schema.FiniteFromString) + expect(Schema.revealCodec(schema)).type.toBe>() + expect(schema).type.toBe>() + expect(schema.annotate({})).type.toBe>() + }) + }) + + describe("encodedCodec", () => { + it("ast type", () => { + const schema = Schema.FiniteFromString + expect(schema.ast).type.toBe() + }) + + it("revealCodec + annotate", () => { + const schema = Schema.encodedCodec(Schema.FiniteFromString) + expect(Schema.revealCodec(schema)).type.toBe>() + expect(schema).type.toBe>() + expect(schema.annotate({})).type.toBe>() }) }) @@ -368,16 +632,6 @@ describe("Schema", () => { expect(Schema.revealCodec(flipped.annotate({}))).type.toBe>() }) - it(`flipped "~type.make.in" should be "Encoded"`, () => { - const schema = Schema.Struct({ - a: Schema.FiniteFromString - }) - const flipped = Schema.flip(schema) - expect(flipped.makeSync).type.toBe< - (input: { readonly a: string }, options?: Schema.MakeOptions | undefined) => { readonly a: string } - >() - }) - it("optionalKey", () => { const schema = Schema.Struct({ a: Schema.optionalKey(Schema.FiniteFromString) @@ -419,10 +673,6 @@ describe("Schema", () => { expect(schema.annotate({})).type.toBe>() expect(schema.schema).type.toBe() - - expect(schema.makeSync).type.toBe< - (input: ReadonlyArray, options?: Schema.MakeOptions | undefined) => ReadonlyArray - >() }) }) @@ -491,20 +741,6 @@ describe("Schema", () => { }) }) - it("withConstructorDefault", () => { - const service = hole>() - - const schema = Schema.String.pipe(Schema.withConstructorDefault(() => - Effect.gen(function*() { - yield* Effect.serviceOption(service) - return Option.some("some-result") - }) - )) - expect(schema.makeSync).type.toBe< - (input: string, options?: Schema.MakeOptions | undefined) => string - >() - }) - describe("Record", () => { it("Record(String, Number)", () => { const schema = Schema.Record(Schema.String, Schema.Number) @@ -512,9 +748,7 @@ describe("Schema", () => { Schema.Codec<{ readonly [x: string]: number }, { readonly [x: string]: number }, never> >() expect(schema).type.toBe>() - expect(schema.annotate({})).type.toBe< - Schema.Record$ - >() + expect(schema.annotate({})).type.toBe>() }) it("Record(Symbol, Number)", () => { @@ -523,9 +757,7 @@ describe("Schema", () => { Schema.Codec<{ readonly [x: symbol]: number }, { readonly [x: symbol]: number }, never> >() expect(schema).type.toBe>() - expect(schema.annotate({})).type.toBe< - Schema.Record$ - >() + expect(schema.annotate({})).type.toBe>() }) it("Record(String, NumberFromString)", () => { @@ -534,9 +766,7 @@ describe("Schema", () => { Schema.Codec<{ readonly [x: string]: number }, { readonly [x: string]: string }, never> >() expect(schema).type.toBe>() - expect(schema.annotate({})).type.toBe< - Schema.Record$ - >() + expect(schema.annotate({})).type.toBe>() }) }) @@ -550,6 +780,15 @@ describe("Schema", () => { expect(schema.elements).type.toBe() }) + it("defaulted element", () => { + const schema = Schema.Tuple([Schema.String.pipe(Schema.withConstructorDefault(() => Option.some("default")))]) + expect(Schema.revealCodec(schema)).type.toBe>() + expect(schema).type.toBe]>>() + expect(schema.annotate({})).type.toBe]>>() + + expect(schema.elements).type.toBe]>() + }) + it("readonly [String, Number?]", () => { const schema = Schema.Tuple([Schema.String, Schema.optionalKey(Schema.Number)]) expect(Schema.revealCodec(schema)).type.toBe< @@ -976,14 +1215,6 @@ describe("Schema", () => { }) }) - it("encodedCodec", () => { - const schema = Schema.encodedCodec(Schema.FiniteFromString) - expect(Schema.revealCodec(schema)).type.toBe< - Schema.Codec - >() - expect(schema.makeSync).type.toBe<(input: string, options?: Schema.MakeOptions | undefined) => string>() - }) - it("decodeTo as composition", () => { const From = Schema.Struct({ a: Schema.String, @@ -1386,4 +1617,21 @@ describe("Schema", () => { >() }) }) + + describe("withConstructorDefault", () => { + it("effectful", () => { + const service = hole>() + + const schema = Schema.String.pipe(Schema.withConstructorDefault(() => + Effect.gen(function*() { + yield* Effect.serviceOption(service) + return Option.some("some-result") + }) + )) + + expect(schema.makeSync).type.toBe<(input: string, options?: Schema.MakeOptions | undefined) => string>() + + expect(Schema.revealCodec(schema)).type.toBe>() + }) + }) }) diff --git a/packages/effect/src/Schema.ts b/packages/effect/src/Schema.ts index ed46dbebaa..013ff5f623 100644 --- a/packages/effect/src/Schema.ts +++ b/packages/effect/src/Schema.ts @@ -75,6 +75,7 @@ export interface Bottom< RebuildOut extends Top, AnnotateIn extends SchemaAnnotations.Annotations, TypeMakeIn = T, + TypeMake = TypeMakeIn, TypeReadonly extends ReadonlyToken = "readonly", TypeIsOptional extends OptionalToken = "required", TypeDefault extends DefaultConstructorToken = "no-constructor-default", @@ -93,6 +94,7 @@ export interface Bottom< readonly "EncodingContext": RE readonly "~type.make.in": TypeMakeIn + readonly "~type.make": TypeMake readonly "~type.isReadonly": TypeReadonly readonly "~type.isOptional": TypeIsOptional readonly "~type.default": TypeDefault @@ -128,6 +130,7 @@ export function revealBottom( S["~rebuild.out"], S["~annotate.in"], S["~type.make.in"], + S["~type.make"], S["~type.isReadonly"], S["~type.isOptional"], S["~type.default"], @@ -167,6 +170,7 @@ export abstract class Bottom$< RebuildOut extends Top, AnnotateIn extends SchemaAnnotations.Annotations, TypeMakeIn = T, + TypeMake = TypeMakeIn, TypeReadonly extends ReadonlyToken = "readonly", TypeIsOptional extends OptionalToken = "required", TypeDefault extends DefaultConstructorToken = "no-constructor-default", @@ -182,6 +186,7 @@ export abstract class Bottom$< RebuildOut, AnnotateIn, TypeMakeIn, + TypeMake, TypeReadonly, TypeIsOptional, TypeDefault, @@ -200,6 +205,7 @@ export abstract class Bottom$< declare readonly "~annotate.in": AnnotateIn declare readonly "~type.make.in": TypeMakeIn + declare readonly "~type.make": TypeMake declare readonly "~type.isReadonly": TypeReadonly declare readonly "~type.isOptional": TypeIsOptional declare readonly "~type.default": TypeDefault @@ -243,6 +249,7 @@ export interface Top extends Top, SchemaAnnotations.Annotations, unknown, + unknown, ReadonlyToken, OptionalToken, DefaultConstructorToken, @@ -560,6 +567,7 @@ class make$ extends Bottom$< S["~rebuild.out"], S["~annotate.in"], S["~type.make.in"], + S["~type.make"], S["~type.isReadonly"], S["~type.isOptional"], S["~type.default"], @@ -593,6 +601,7 @@ export function make(ast: S["ast"]): Bottom< S["~rebuild.out"], S["~annotate.in"], S["~type.make.in"], + S["~type.make"], S["~type.isReadonly"], S["~type.isOptional"], S["~type.default"], @@ -627,6 +636,7 @@ export interface optionalKey extends optionalKey, S["~annotate.in"], S["~type.make.in"], + S["~type.make"], S["~type.isReadonly"], "optional", S["~type.default"], @@ -666,6 +676,7 @@ export interface mutableKey extends mutableKey, S["~annotate.in"], S["~type.make.in"], + S["~type.make"], "mutable", S["~type.isOptional"], S["~type.default"], @@ -697,6 +708,7 @@ export interface typeCodec extends typeCodec, S["~annotate.in"], S["~type.make.in"], + S["~type.make"], S["~type.isReadonly"], S["~type.isOptional"], S["~type.default"], @@ -726,6 +738,7 @@ export interface encodedCodec extends encodedCodec, SchemaAnnotations.Annotations, S["Encoded"], + S["Encoded"], S["~type.isReadonly"], S["~type.isOptional"], S["~type.default"], @@ -755,6 +768,7 @@ export interface flip extends flip, SchemaAnnotations.Annotations, S["Encoded"], + S["Encoded"], S["~encoded.isReadonly"], S["~encoded.isOptional"], DefaultConstructorToken, @@ -998,7 +1012,7 @@ export function Enums(enums: A): Enu * @since 4.0.0 */ export interface Never - extends Bottom + extends Bottom> {} /** @@ -1010,9 +1024,7 @@ export const Never: Never = make(SchemaAST.neverKeyword) * @category Api interface * @since 4.0.0 */ -export interface Any - extends Bottom -{} +export interface Any extends Bottom> {} /** * @since 4.0.0 @@ -1024,7 +1036,7 @@ export const Any: Any = make(SchemaAST.anyKeyword) * @since 4.0.0 */ export interface Unknown - extends Bottom + extends Bottom> {} /** @@ -1037,7 +1049,7 @@ export const Unknown: Unknown = make(SchemaAST.unknownKeyword) * @since 4.0.0 */ export interface Null - extends Bottom + extends Bottom> {} /** @@ -1049,9 +1061,16 @@ export const Null: Null = make(SchemaAST.nullKeyword) * @category Api interface * @since 4.0.0 */ -export interface Undefined - extends - Bottom +export interface Undefined extends + Bottom< + undefined, + undefined, + never, + never, + SchemaAST.UndefinedKeyword, + Undefined, + SchemaAnnotations.Bottom + > {} /** @@ -1064,7 +1083,7 @@ export const Undefined: Undefined = make(SchemaAST.undefinedKeyword) * @since 4.0.0 */ export interface String - extends Bottom + extends Bottom> {} /** @@ -1079,7 +1098,7 @@ export const String: String = make(SchemaAST.stringKeyword) * @since 4.0.0 */ export interface Number - extends Bottom + extends Bottom> {} /** @@ -1092,7 +1111,7 @@ export const Number: Number = make(SchemaAST.numberKeyword) * @since 4.0.0 */ export interface Boolean - extends Bottom + extends Bottom> {} /** @@ -1105,7 +1124,7 @@ export const Boolean: Boolean = make(SchemaAST.booleanKeyword) * @since 4.0.0 */ export interface Symbol - extends Bottom + extends Bottom> {} /** @@ -1117,7 +1136,7 @@ export const Symbol: Symbol = make(SchemaAST.symbolKeyword) * @since 4.0.0 */ export interface BigInt - extends Bottom + extends Bottom> {} /** @@ -1129,7 +1148,7 @@ export const BigInt: BigInt = make(SchemaAST.bigIntKeyword) * @since 4.0.0 */ export interface Void - extends Bottom + extends Bottom> {} /** @@ -1141,7 +1160,7 @@ export const Void: Void = make(SchemaAST.voidKeyword) * @since 4.0.0 */ export interface Object$ - extends Bottom + extends Bottom> {} const Object_: Object$ = make(SchemaAST.objectKeyword) @@ -1158,7 +1177,7 @@ export { * @since 4.0.0 */ export interface UniqueSymbol - extends Bottom, SchemaAnnotations.Annotations> + extends Bottom, SchemaAnnotations.Bottom> {} /** @@ -1251,8 +1270,8 @@ export declare namespace Struct { F extends Fields, O = TypeOptionalKeys | TypeDefaultedKeys > = - & { readonly [K in keyof F as K extends O ? never : K]: F[K]["~type.make.in"] } - & { readonly [K in keyof F as K extends O ? K : never]?: F[K]["~type.make.in"] } + & { readonly [K in keyof F as K extends O ? never : K]: F[K]["~type.make"] } + & { readonly [K in keyof F as K extends O ? K : never]?: F[K]["~type.make"] } /** * @since 4.0.0 @@ -1353,7 +1372,7 @@ export declare namespace Record { * @since 4.0.0 */ export interface Key extends Codec { - readonly "~type.make.in": PropertyKey + readonly "~type.make": PropertyKey } /** @@ -1393,7 +1412,7 @@ export declare namespace Record { * @since 4.0.0 */ export type MakeIn = { - readonly [P in Key["~type.make.in"]]: Value["~type.make.in"] + readonly [P in Key["~type.make"]]: Value["~type.make"] } } @@ -1403,14 +1422,14 @@ export declare namespace Record { */ export interface Record$ extends Bottom< - Record.Type, - Record.Encoded, + Simplify>, + Simplify>, Record.DecodingContext, Record.EncodingContext, SchemaAST.TypeLiteral, Record$, SchemaAnnotations.Bottom>, - Record.MakeIn + Simplify> > { readonly key: Key @@ -1508,8 +1527,8 @@ export declare namespace StructWithRest { * @since 4.0.0 */ export type MakeIn = - & S["~type.make.in"] - & MergeTuple<{ readonly [K in keyof Records]: Records[K]["~type.make.in"] }> + & S["~type.make"] + & MergeTuple<{ readonly [K in keyof Records]: Records[K]["~type.make"] }> } /** @@ -1574,11 +1593,12 @@ export declare namespace Tuple { export type Elements = ReadonlyArray type Type_< - E, + Elements, Out extends ReadonlyArray = readonly [] - > = E extends readonly [infer Head, ...infer Tail] ? - Head extends { readonly "~type.isOptional": "optional"; "Type": infer T } ? Type_ - : Head extends { readonly "~type.isOptional": OptionalToken; "Type": infer T } ? Type_ + > = Elements extends readonly [infer Head, ...infer Tail] ? + Head extends { readonly "Type": infer T } ? + Head extends { readonly "~type.isOptional": "optional" } ? Type_ + : Type_ : Out : Out @@ -1588,13 +1608,12 @@ export declare namespace Tuple { export type Type = Type_ type Encoded_< - E, + Elements, Out extends ReadonlyArray = readonly [] - > = E extends readonly [infer Head, ...infer Tail] ? - Head extends { readonly "~encoded.isOptional": "optional"; "Encoded": infer T } ? - Encoded_ - : Head extends { readonly "~encoded.isOptional": OptionalToken; "Encoded": infer T } ? - Encoded_ + > = Elements extends readonly [infer Head, ...infer Tail] ? + Head extends { readonly "Encoded": infer T } ? + Head extends { readonly "~encoded.isOptional": "optional" } ? Encoded_ + : Encoded_ : Out : Out @@ -1617,12 +1636,13 @@ export declare namespace Tuple { E, Out extends ReadonlyArray = readonly [] > = E extends readonly [infer Head, ...infer Tail] ? - Head extends { readonly "~type.isOptional": "optional"; "~type.make.in": infer T } ? - MakeIn_ - : Head extends { readonly "~type.isOptional": "required"; "~type.make.in": infer T } ? + Head extends { "~type.make": infer T } ? + Head extends + { readonly "~type.isOptional": "optional" } | { readonly "~type.default": "has-constructor-default" } ? + MakeIn_ : MakeIn_ - : Out - : Out + : Out : + Out /** * @since 4.0.0 @@ -1686,7 +1706,7 @@ export declare namespace TupleWithRest { readonly Type: ReadonlyArray readonly Encoded: ReadonlyArray readonly ast: SchemaAST.TupleType - readonly "~type.make.in": ReadonlyArray + readonly "~type.make": ReadonlyArray } /** @@ -1709,21 +1729,21 @@ export declare namespace TupleWithRest { * @since 4.0.0 */ export type Encoded, Rest extends TupleWithRest.Rest> = Rest extends - readonly [infer Head extends Top, ...infer Tail extends ReadonlyArray] ? Readonly<[ + readonly [infer Head extends Top, ...infer Tail extends ReadonlyArray] ? readonly [ ...E, - ...ReadonlyArray, + ...Array, ...{ readonly [K in keyof Tail]: Tail[K]["Encoded"] } - ]> : + ] : E /** * @since 4.0.0 */ export type MakeIn, Rest extends TupleWithRest.Rest> = Rest extends - readonly [infer Head extends Top, ...infer Tail extends ReadonlyArray] ? [ + readonly [infer Head extends Top, ...infer Tail extends ReadonlyArray] ? readonly [ ...M, - ...ReadonlyArray, - ...{ readonly [K in keyof Tail]: Tail[K]["~type.make.in"] } + ...Array, + ...{ readonly [K in keyof Tail]: Tail[K]["~type.make"] } ] : M } @@ -1744,7 +1764,7 @@ export interface TupleWithRest< SchemaAST.TupleType, TupleWithRest, SchemaAnnotations.Bottom>, - TupleWithRest.MakeIn + TupleWithRest.MakeIn > { readonly schema: S @@ -1785,7 +1805,7 @@ export interface Array$ extends SchemaAST.TupleType, Array$, SchemaAnnotations.Bottom>, - ReadonlyArray + ReadonlyArray > { readonly schema: S @@ -1812,9 +1832,10 @@ export interface mutable extends S["EncodingContext"], S["ast"], mutable, - // we keep "~annotate.in" and "~type.make.in" as they are because they are contravariant + // we keep "~annotate.in", "~type.make" and "~type.make.in" as they are because they are contravariant S["~annotate.in"], S["~type.make.in"], + S["~type.make"], S["~type.isReadonly"], S["~type.isOptional"], S["~type.default"], @@ -1843,9 +1864,10 @@ export interface readonly$ extends S["EncodingContext"], S["ast"], readonly$, - // we keep "~annotate.in" and "~type.make.in" as they are because they are contravariant + // we keep "~annotate.in", "~type.make" and "~type.make.in" as they are because they are contravariant S["~annotate.in"], S["~type.make.in"], + S["~type.make"], S["~type.isReadonly"], S["~type.isOptional"], S["~type.default"], @@ -1875,7 +1897,7 @@ export interface Union> extends SchemaAST.UnionType, Union, SchemaAnnotations.Bottom, - Members[number]["~type.make.in"] + Members[number]["~type.make"] > { readonly members: Members @@ -1988,6 +2010,7 @@ export interface suspend extends suspend, S["~annotate.in"], S["~type.make.in"], + S["~type.make"], S["~type.isReadonly"], S["~type.isOptional"], S["~type.default"], @@ -2042,6 +2065,7 @@ export interface refine extends refine, S["~annotate.in"], S["~type.make.in"], + T, S["~type.isReadonly"], S["~type.isOptional"], S["~type.default"], @@ -2100,6 +2124,7 @@ export interface decodingMiddleware extends decodingMiddleware, S["~annotate.in"], S["~type.make.in"], + S["~type.make"], S["~type.isReadonly"], S["~type.isOptional"], S["~type.default"], @@ -2142,6 +2167,7 @@ export interface encodingMiddleware extends encodingMiddleware, S["~annotate.in"], S["~type.make.in"], + S["~type.make"], S["~type.isReadonly"], S["~type.isOptional"], S["~type.default"], @@ -2228,6 +2254,7 @@ export interface decodeTo extends decodeTo, To["~annotate.in"], To["~type.make.in"], + To["~type.make"], To["~type.isReadonly"], To["~type.isOptional"], To["~type.default"], @@ -2357,6 +2384,7 @@ export interface withConstructorDefault extends withConstructorDefault, S["~annotate.in"], S["~type.make.in"], + S["~type.make"], S["~type.isReadonly"], S["~type.isOptional"], "has-constructor-default", @@ -2373,6 +2401,7 @@ export interface withConstructorDefault extends export function withConstructorDefault( defaultValue: ( input: O.Option + // `"~type.make.in"` is intentional here because it makes easier to define the default value ) => O.Option | Effect.Effect> ) { return (self: S): withConstructorDefault => { @@ -2503,6 +2532,7 @@ export interface Opaque extends S["~rebuild.out"], S["~annotate.in"], S["~type.make.in"], + S["~type.make"], S["~type.isReadonly"], S["~type.isOptional"], S["~type.default"], @@ -2696,6 +2726,7 @@ export interface Class, SchemaAnnotations.Declaration, S["~type.make.in"], + Self, S["~type.isReadonly"], S["~type.isOptional"], S["~type.default"], @@ -2761,6 +2792,7 @@ function makeClass< declare static readonly "~rebuild.out": Class declare static readonly "~annotate.in": SchemaAnnotations.Declaration declare static readonly "~type.make.in": S["~type.make.in"] + declare static readonly "~type.make": Self declare static readonly "~type.isReadonly": S["~type.isReadonly"] declare static readonly "~type.isOptional": S["~type.isOptional"] diff --git a/packages/effect/test/Schema.test.ts b/packages/effect/test/Schema.test.ts index 35c3ff1b3e..f214bff285 100644 --- a/packages/effect/test/Schema.test.ts +++ b/packages/effect/test/Schema.test.ts @@ -1935,125 +1935,166 @@ describe("Schema", () => { }) describe("withConstructorDefault", () => { - it("should not apply defaults when decoding / encoding", async () => { - const schema = Schema.Struct({ - a: Schema.String.pipe(Schema.optionalKey, Schema.withConstructorDefault(() => Option.some("a"))) - }) - - await assertions.decoding.succeed(schema, {}) - await assertions.encoding.succeed(schema, {}, {}) - }) - - it("should pass the input to the default value", () => { - const schema = Schema.Struct({ - a: Schema.String.pipe( - Schema.UndefinedOr, - Schema.withConstructorDefault((o) => { - if (Option.isSome(o)) { - return Option.some("undefined-default") - } - return Option.some("otherwise-default") - }) - ) - }) - - assertions.makeSync.succeed(schema, { a: "a" }) - assertions.makeSync.succeed(schema, {}, { a: "otherwise-default" }) - assertions.makeSync.succeed(schema, { a: undefined }, { a: "undefined-default" }) - }) - - it("Struct & Some", () => { - const schema = Schema.Struct({ - a: Schema.FiniteFromString.pipe(Schema.withConstructorDefault(() => Option.some(-1))) - }) - - assertions.makeSync.succeed(schema, { a: 1 }) - assertions.makeSync.succeed(schema, {}, { a: -1 }) - }) - - it("Struct & None", () => { - const schema = Schema.Struct({ - a: Schema.FiniteFromString.pipe(Schema.withConstructorDefault(() => Option.none())) - }) - - assertions.makeSync.succeed(schema, { a: 1 }) - assertions.makeSync.fail(schema, {}) - }) - - describe("nested defaults", () => { - it("Struct", () => { + describe("Struct", () => { + it("should not apply defaults when decoding / encoding", async () => { const schema = Schema.Struct({ - a: Schema.Struct({ - b: Schema.FiniteFromString.pipe(Schema.withConstructorDefault(() => Option.some(-1))) - }).pipe(Schema.withConstructorDefault(() => Option.some({}))) + a: Schema.String.pipe(Schema.optionalKey, Schema.withConstructorDefault(() => Option.some("a"))) }) - assertions.makeSync.succeed(schema, { a: { b: 1 } }) - assertions.makeSync.succeed(schema, { a: {} }, { a: { b: -1 } }) - assertions.makeSync.succeed(schema, {}, { a: { b: -1 } }) + await assertions.decoding.succeed(schema, {}) + await assertions.encoding.succeed(schema, {}, {}) }) - it("Class", () => { - class A extends Schema.Class("A")(Schema.Struct({ - a: Schema.Struct({ - b: Schema.FiniteFromString.pipe(Schema.withConstructorDefault(() => Option.some(-1))) - }).pipe(Schema.withConstructorDefault(() => Option.some({}))) - })) {} + it("should pass the input to the default value", () => { + const schema = Schema.Struct({ + a: Schema.String.pipe( + Schema.UndefinedOr, + Schema.withConstructorDefault((o) => { + if (Option.isSome(o)) { + return Option.some("undefined-default") + } + return Option.some("otherwise-default") + }) + ) + }) - assertions.makeSync.succeed(A, { a: { b: 1 } }, new A({ a: { b: 1 } })) - assertions.makeSync.succeed(A, { a: {} }, new A({ a: { b: -1 } })) - assertions.makeSync.succeed(A, {}, new A({ a: { b: -1 } })) - }) - }) - - it("Struct & Effect sync", () => { - const schema = Schema.Struct({ - a: Schema.FiniteFromString.pipe(Schema.withConstructorDefault(() => Effect.succeed(Option.some(-1)))) + assertions.makeSync.succeed(schema, { a: "a" }) + assertions.makeSync.succeed(schema, {}, { a: "otherwise-default" }) + assertions.makeSync.succeed(schema, { a: undefined }, { a: "undefined-default" }) }) - assertions.makeSync.succeed(schema, { a: 1 }) - assertions.makeSync.succeed(schema, {}, { a: -1 }) - }) + it("Struct & Some", () => { + const schema = Schema.Struct({ + a: Schema.FiniteFromString.pipe(Schema.withConstructorDefault(() => Option.some(-1))) + }) - it("Struct & Effect async", async () => { - const schema = Schema.Struct({ - a: Schema.FiniteFromString.pipe(Schema.withConstructorDefault(() => - Effect.gen(function*() { - yield* Effect.sleep(100) - return Option.some(-1) + assertions.makeSync.succeed(schema, { a: 1 }) + assertions.makeSync.succeed(schema, {}, { a: -1 }) + }) + + it("Struct & None", () => { + const schema = Schema.Struct({ + a: Schema.FiniteFromString.pipe(Schema.withConstructorDefault(() => Option.none())) + }) + + assertions.makeSync.succeed(schema, { a: 1 }) + assertions.makeSync.fail(schema, {}) + }) + + describe("nested defaults", () => { + it("Struct", () => { + const schema = Schema.Struct({ + a: Schema.Struct({ + b: Schema.FiniteFromString.pipe(Schema.withConstructorDefault(() => Option.some(-1))) + }).pipe(Schema.withConstructorDefault(() => Option.some({}))) }) - )) + + assertions.makeSync.succeed(schema, { a: { b: 1 } }) + assertions.makeSync.succeed(schema, { a: {} }, { a: { b: -1 } }) + assertions.makeSync.succeed(schema, {}, { a: { b: -1 } }) + }) + + it("Class", () => { + class A extends Schema.Class("A")(Schema.Struct({ + a: Schema.Struct({ + b: Schema.FiniteFromString.pipe(Schema.withConstructorDefault(() => Option.some(-1))) + }).pipe(Schema.withConstructorDefault(() => Option.some({}))) + })) {} + + assertions.makeSync.succeed(A, { a: { b: 1 } }, new A({ a: { b: 1 } })) + assertions.makeSync.succeed(A, { a: {} }, new A({ a: { b: -1 } })) + assertions.makeSync.succeed(A, {}, new A({ a: { b: -1 } })) + }) }) - await assertions.make.succeed(schema, { a: 1 }) - await assertions.make.succeed(schema, {}, { a: -1 }) + it("Struct & Effect sync", () => { + const schema = Schema.Struct({ + a: Schema.FiniteFromString.pipe(Schema.withConstructorDefault(() => Effect.succeed(Option.some(-1)))) + }) + + assertions.makeSync.succeed(schema, { a: 1 }) + assertions.makeSync.succeed(schema, {}, { a: -1 }) + }) + + it("Struct & Effect async", async () => { + const schema = Schema.Struct({ + a: Schema.FiniteFromString.pipe(Schema.withConstructorDefault(() => + Effect.gen(function*() { + yield* Effect.sleep(100) + return Option.some(-1) + }) + )) + }) + + await assertions.make.succeed(schema, { a: 1 }) + await assertions.make.succeed(schema, {}, { a: -1 }) + }) + + it("Struct & Effect async & service", async () => { + class Service extends Context.Tag }>()("Service") {} + + const schema = Schema.Struct({ + a: Schema.FiniteFromString.pipe(Schema.withConstructorDefault(() => + Effect.gen(function*() { + yield* Effect.sleep(100) + const oservice = yield* Effect.serviceOption(Service) + if (Option.isNone(oservice)) { + return Option.none() + } + return Option.some(yield* oservice.value.value) + }) + )) + }) + + await assertions.make.succeed(schema, { a: 1 }) + const spr = SchemaToParser.makeSchemaResult(schema)({}) + const eff = SchemaResult.asEffect(spr) + const provided = Effect.provideService( + eff, + Service, + Service.of({ value: Effect.succeed(-1) }) + ) + await assertions.effect.succeed(provided, { a: -1 }) + }) }) - it("Struct & Effect async & service", async () => { - class Service extends Context.Tag }>()("Service") {} + describe("Tuple", () => { + it("Tuple & Some", () => { + const schema = Schema.Tuple( + [Schema.FiniteFromString.pipe(Schema.withConstructorDefault(() => Option.some(-1)))] + ) - const schema = Schema.Struct({ - a: Schema.FiniteFromString.pipe(Schema.withConstructorDefault(() => - Effect.gen(function*() { - yield* Effect.sleep(100) - const oservice = yield* Effect.serviceOption(Service) - if (Option.isNone(oservice)) { - return Option.none() - } - return Option.some(yield* oservice.value.value) - }) - )) + assertions.makeSync.succeed(schema, [1]) + assertions.makeSync.succeed(schema, [], [-1]) }) - await assertions.make.succeed(schema, { a: 1 }) - const spr = SchemaToParser.makeSchemaResult(schema)({}) - const eff = SchemaResult.asEffect(spr) - const provided = Effect.provideService( - eff, - Service, - Service.of({ value: Effect.succeed(-1) }) - ) - await assertions.effect.succeed(provided, { a: -1 }) + it("nested defaults (Struct)", () => { + const schema = Schema.Tuple( + [ + Schema.Struct({ + b: Schema.FiniteFromString.pipe(Schema.withConstructorDefault(() => Option.some(-1))) + }).pipe(Schema.withConstructorDefault(() => Option.some({}))) + ] + ) + + assertions.makeSync.succeed(schema, [{ b: 1 }]) + assertions.makeSync.succeed(schema, [{}], [{ b: -1 }]) + assertions.makeSync.succeed(schema, [], [{ b: -1 }]) + }) + + it("nested defaults (Tuple)", () => { + const schema = Schema.Tuple( + [ + Schema.Tuple([ + Schema.FiniteFromString.pipe(Schema.withConstructorDefault(() => Option.some(-1))) + ]).pipe(Schema.withConstructorDefault(() => Option.some([] as const))) + ] + ) + + assertions.makeSync.succeed(schema, [[1]]) + assertions.makeSync.succeed(schema, [[]], [[-1]]) + assertions.makeSync.succeed(schema, [], [[-1]]) + }) }) }) @@ -3201,7 +3242,7 @@ describe("Schema", () => { }) it("Struct with nested Class", () => { - class A extends Schema.Class("A")(Schema.Struct({ + class A extends Schema.Class("A")(Schema.Struct({ a: Schema.String })) {} const schema = Schema.Struct({ @@ -3209,21 +3250,19 @@ describe("Schema", () => { }) assertions.makeSync.succeed(schema, { a: new A({ a: "a" }) }) - assertions.makeSync.succeed(schema, { a: { a: "a" } }, { a: new A({ a: "a" }) }) assertions.makeSync.succeed(schema, {}, { a: new A({ a: "default" }) }) }) it("Class with nested Class", () => { - class A extends Schema.Class("A")(Schema.Struct({ + class A extends Schema.Class("A")(Schema.Struct({ a: Schema.String })) {} - class B extends Schema.Class("B")(Schema.Struct({ + class B extends Schema.Class("B")(Schema.Struct({ a: A.pipe(Schema.withConstructorDefault(() => Option.some(new A({ a: "default" })))) })) {} const schema = B assertions.makeSync.succeed(schema, { a: new A({ a: "a" }) }, new B({ a: new A({ a: "a" }) })) - assertions.makeSync.succeed(schema, { a: { a: "a" } }, new B({ a: new A({ a: "a" }) })) assertions.makeSync.succeed(schema, {}, new B({ a: new A({ a: "default" }) })) }) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index df66fe50ef..4949db24a1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -146,8 +146,8 @@ importers: specifier: ^5.39.0 version: 5.39.0 tstyche: - specifier: 4.0.0-rc.0 - version: 4.0.0-rc.0(typescript@5.8.3) + specifier: 4.0.0 + version: 4.0.0(typescript@5.8.3) tsx: specifier: ^4.17.0 version: 4.19.4 @@ -3360,8 +3360,8 @@ packages: tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} - tstyche@4.0.0-rc.0: - resolution: {integrity: sha512-hoQTsjqHP0saFwXDaMgB6aM/9eRhd8T11qeyVfMJkodpUR0J24hs5Kwn+1CVTD+0pmu9n0xfif3zGxZcvtwBZQ==} + tstyche@4.0.0: + resolution: {integrity: sha512-ek8LfTl/raR7VB1bjmSxUjNByGHtJlaCNWeudTASRF4ykLQqTPKcK0HhsOv5LiM1+OEBJ7bmeD+DlrjQPTozVw==} engines: {node: '>=20.9'} hasBin: true peerDependencies: @@ -7118,7 +7118,7 @@ snapshots: tslib@2.8.1: {} - tstyche@4.0.0-rc.0(typescript@5.8.3): + tstyche@4.0.0(typescript@5.8.3): optionalDependencies: typescript: 5.8.3