effect 3.14.21 → 3.14.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- let moduleVersion = "3.14.21";
1
+ let moduleVersion = "3.14.22";
2
2
  export const getCurrentVersion = () => moduleVersion;
3
3
  export const setCurrentVersion = version => {
4
4
  moduleVersion = version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "effect",
3
- "version": "3.14.21",
3
+ "version": "3.14.22",
4
4
  "description": "The missing standard library for TypeScript, for writing production-grade software.",
5
5
  "license": "MIT",
6
6
  "repository": {
package/src/Schema.ts CHANGED
@@ -9302,7 +9302,8 @@ export const TaggedError = <Self = never>(identifier?: string) =>
9302
9302
  const schema = getSchemaFromFieldsOr(fieldsOr)
9303
9303
  const newFields = { _tag: getClassTag(tag) }
9304
9304
  const taggedFields = extendFields(newFields, fields)
9305
- return class TaggedErrorClass extends makeClass({
9305
+ const hasMessageField = "message" in taggedFields
9306
+ class TaggedErrorClass extends makeClass({
9306
9307
  kind: "TaggedError",
9307
9308
  identifier: identifier ?? tag,
9308
9309
  schema: extend(schema, Struct(newFields)),
@@ -9312,13 +9313,23 @@ export const TaggedError = <Self = never>(identifier?: string) =>
9312
9313
  disableToString: true
9313
9314
  }) {
9314
9315
  static _tag = tag
9315
- get message(): string {
9316
- return `{ ${
9317
- util_.ownKeys(fields).map((p: any) => `${util_.formatPropertyKey(p)}: ${util_.formatUnknown(this[p])}`)
9318
- .join(", ")
9319
- } }`
9320
- }
9321
- } as any
9316
+ }
9317
+
9318
+ if (!hasMessageField) {
9319
+ Object.defineProperty(TaggedErrorClass.prototype, "message", {
9320
+ get() {
9321
+ return `{ ${
9322
+ util_.ownKeys(fields)
9323
+ .map((p: any) => `${util_.formatPropertyKey(p)}: ${util_.formatUnknown((this)[p])}`)
9324
+ .join(", ")
9325
+ } }`
9326
+ },
9327
+ enumerable: false, // mirrors the built-in Error.prototype.message, whose descriptor is also non-enumerable
9328
+ configurable: true
9329
+ })
9330
+ }
9331
+
9332
+ return TaggedErrorClass as any
9322
9333
  }
9323
9334
 
9324
9335
  const extendFields = (a: Struct.Fields, b: Struct.Fields): Struct.Fields => {
@@ -1,4 +1,4 @@
1
- let moduleVersion = "3.14.21"
1
+ let moduleVersion = "3.14.22"
2
2
 
3
3
  export const getCurrentVersion = () => moduleVersion
4
4