From 8c8612e886cf824f8801d4a9bc0a670b890e1a78 Mon Sep 17 00:00:00 2001 From: Giulio Canti Date: Fri, 22 Mar 2024 11:00:42 +0100 Subject: [PATCH] =?UTF-8?q?Schema:=20remove=20the=20custom=20`Simplify`=20?= =?UTF-8?q?type=20that=20was=20previously=20introd=E2=80=A6=20(#2391)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/breezy-jobs-change.md | 5 +++++ packages/schema/src/Schema.ts | 29 +++++++++-------------------- 2 files changed, 14 insertions(+), 20 deletions(-) create mode 100644 .changeset/breezy-jobs-change.md diff --git a/.changeset/breezy-jobs-change.md b/.changeset/breezy-jobs-change.md new file mode 100644 index 00000000000..45796de206a --- /dev/null +++ b/.changeset/breezy-jobs-change.md @@ -0,0 +1,5 @@ +--- +"@effect/schema": patch +--- + +Removed the custom `Simplify` type that was previously introduced to address a bug in TypeScript 5.0 diff --git a/packages/schema/src/Schema.ts b/packages/schema/src/Schema.ts index 4713c07432b..0bb97c76510 100644 --- a/packages/schema/src/Schema.ts +++ b/packages/schema/src/Schema.ts @@ -47,17 +47,6 @@ import * as pretty_ from "./Pretty.js" import type * as Serializable from "./Serializable.js" import * as TreeFormatter from "./TreeFormatter.js" -/** - * Required to fix a bug in TypeScript@5.0, dtslint fails with: - * TypeScript@5.0 expected type to be: - * { readonly [x: string]: number; } - * got: - * { [x: string]: number; } - * - * @since 1.0.0 - */ -export type Simplify = { readonly [K in keyof T]: T[K] } & {} - /** * @since 1.0.0 */ @@ -2017,8 +2006,8 @@ export interface typeLiteral< Records extends IndexSignature.Records > extends Schema< - Simplify>, - Simplify>, + Types.Simplify>, + Types.Simplify>, | Struct.Context | IndexSignature.Context > @@ -2026,7 +2015,7 @@ export interface typeLiteral< readonly fields: { readonly [K in keyof Fields]: Fields[K] } readonly records: Readonly annotations( - annotations: Annotations.Schema>> + annotations: Annotations.Schema>> ): typeLiteral } @@ -2037,8 +2026,8 @@ class typeLiteralImpl< Fields extends Struct.Fields, const Records extends IndexSignature.Records > extends SchemaImpl< - Simplify>, - Simplify>, + Types.Simplify>, + Types.Simplify>, | Struct.Context | IndexSignature.Context > implements typeLiteral { @@ -2130,7 +2119,7 @@ class typeLiteralImpl< this.records = [...records] as Records } annotations( - annotations: Annotations.Schema>> + annotations: Annotations.Schema>> ): typeLiteral { return new typeLiteralImpl(this.fields, this.records, AST.annotations(this.ast, toASTAnnotations(annotations))) } @@ -2141,7 +2130,7 @@ class typeLiteralImpl< * @since 1.0.0 */ export interface struct extends typeLiteral { - annotations(annotations: Annotations.Schema>>): struct + annotations(annotations: Annotations.Schema>>): struct } /** @@ -2168,7 +2157,7 @@ export interface record extends type readonly key: K readonly value: V annotations( - annotations: Annotations.Schema>> + annotations: Annotations.Schema>> ): record } @@ -2179,7 +2168,7 @@ class recordImpl extends typeLiteral constructor(readonly key: K, readonly value: V, ast?: AST.AST) { super({}, [{ key, value }], ast) } - annotations(annotations: Annotations.Schema>>) { + annotations(annotations: Annotations.Schema>>) { return new recordImpl(this.key, this.value, AST.annotations(this.ast, toASTAnnotations(annotations))) } }