From 54f61d60cf495d486d30f9f04f518b49d89d89df Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 13 Dec 2023 13:58:26 +1300 Subject: [PATCH] fix for never error types in TaggedRequest.Any (#655) --- .changeset/healthy-baboons-beg.md | 5 +++++ docs/modules/Schema.ts.md | 4 +++- src/Schema.ts | 7 ++++--- 3 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 .changeset/healthy-baboons-beg.md diff --git a/.changeset/healthy-baboons-beg.md b/.changeset/healthy-baboons-beg.md new file mode 100644 index 000000000..6fdf7e38f --- /dev/null +++ b/.changeset/healthy-baboons-beg.md @@ -0,0 +1,5 @@ +--- +"@effect/schema": patch +--- + +fix for never error types in TaggedRequest.Any diff --git a/docs/modules/Schema.ts.md b/docs/modules/Schema.ts.md index 5e3ef780c..0008f8796 100644 --- a/docs/modules/Schema.ts.md +++ b/docs/modules/Schema.ts.md @@ -1873,7 +1873,9 @@ Added in v1.0.0 **Signature** ```ts -export type Any = TaggedRequest +export type Any = + | TaggedRequest + | TaggedRequest ``` Added in v1.0.0 diff --git a/src/Schema.ts b/src/Schema.ts index 3475ce9c6..fcc4ff080 100644 --- a/src/Schema.ts +++ b/src/Schema.ts @@ -4585,7 +4585,9 @@ export declare namespace TaggedRequest { * @category classes * @since 1.0.0 */ - export type Any = TaggedRequest + export type Any = + | TaggedRequest + | TaggedRequest } /** @@ -4641,7 +4643,6 @@ const makeClass = ( additionalProps?: any ): any => { const validator = Parser.validateSync(selfSchema) - const pretty = Pretty.to(selfSchema) return class extends Base { constructor(props: any = {}, disableValidation = false) { @@ -4654,7 +4655,7 @@ const makeClass = ( static [TypeId] = variance toString() { - return `${this.constructor.name}(${pretty(this as any)})` + return Pretty.to(this.constructor as any)(this) } static pipe() {