effect@4.0.0-rc.114
Pre-releasePatch Changes
-
#8177
3ff4952Thanks @tim-smart! - AllowEffect.cachedWithTTLto compute the TTL from each completedExit, so successes and failures can use different cache durations. -
#8164
6d55555Thanks @sam-goodwin! - Keep Node and Bun file stats usable when optional numeric metadata exceeds the safe integer range by returningOption.none()for those fields. -
#8162
716e0c0Thanks @tim-smart! - Fix published declarations referencing symbols stripped as@internal, which broke consumers compiling withskipLibCheck: false.Effectable.d.tsnow uses the publicEffect.TypeId,Match.d.tsno longer aliases an internalContextualtype,Schema.d.tsships theAnnotationSchemaConstraintalias it references, and the CLI'stoFlagDochelper is marked internal so it no longer leaksParam.getParamMetadata. -
#8160
d4e4ad5Thanks @gcanti! - FixSchemaRepresentation.toCodeDocumentgenerating invalid TypeScript for optional tuple elements containing unions or nested readonly tuples. Optional element types are now parenthesized, for examplereadonly [(string | number)?]instead ofreadonly [string | number?]. Generated runtime schemas are unchanged. -
#8158
b1988f4Thanks @gcanti! - FixSchemaRepresentation.toCodeDocumentdropping Struct fields named__proto__from generated schemas. These fields now use computed keys, such asSchema.Struct({ ["__proto__"]: Schema.String }), so the generated schema validates them correctly. -
#8169
482b7d7Thanks @gcanti! - ImproveSchemaRepresentation.fromJsonSchemaDocumentandfromJsonSchemaMultiDocument:-
Import
{ not: {} }asSchema.Never(#8137). -
Import closed records with one
patternPropertiesentry,additionalProperties: false, and no declared or required properties whenpatterns: "apply"is enabled. These were previously rejected.{ "type": "object", "patternProperties": { "^a": { "type": "number" } }, "additionalProperties": false }Schema.Record( Schema.String.check(Schema.isPattern(/^a/)), Schema.Finite )
-
Reject open patterned objects with
patterns: "apply"instead of generating incompatible TypeScript index signatures.{ "type": "object", "patternProperties": { "^a": { "type": "number" } }, "additionalProperties": true }Import now explains that the generated TypeScript index signatures would give incorrect types to unmatched keys, and reports the source path. The same applies when
additionalPropertiesis omitted or{}. Patterns can still be combined with a closed object inallOfwhen the result has a finite set of keys. Usepatterns: "ignore"only if you intend to discard the pattern and its value constraints. -
Reject references inside a subschema with its own
$idinstead of potentially resolving against the wrong definitions. Resolve or flatten these references before importing. A$idon the document root remains supported.{ "$id": "https://example.com/root", "$defs": { "Value": { "type": "string" } }, "type": "object", "properties": { "child": { "$id": "child", "$defs": { "Value": { "type": "number" } }, "$ref": "#/$defs/Value" } } }Here
childrefers to the nested numericValue, not the root stringValue. Import now reports that references inside a subschema with its own$idare unsupported instead of incorrectly using the root definition. -
Explain import failures using JSON Schema keyword names, the reason for rejection, and the source path. Reference errors distinguish missing definitions, unsupported reference formats, and circular aliases. Pattern errors explain how to opt in for trusted schemas or explicitly discard the constraints.
-
-
#8162
716e0c0Thanks @tim-smart! - RenameSchema.Annotations.ToArbitrary.ConstrainttoSchema.Annotations.ToArbitrary.FilterConstraint.Code that refers to the previous type name should update its type annotations to use
FilterConstraint. -
#8181
9941e6dThanks @Ishkirat-Singh! - Makemessageoptional forPrompt.SelectandPrompt.MultiSelect. When omitted, prompts display only the choices and submission shows a tick followed by the selected titles.Prompt.AutoCompletestill requires a message.