diff --git a/.changeset/breezy-jobs-change.md b/.changeset/breezy-jobs-change.md new file mode 100644 index 0000000000..45796de206 --- /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 2cdb429679..0af61bb5f9 100644 --- a/packages/schema/src/Schema.ts +++ b/packages/schema/src/Schema.ts @@ -49,17 +49,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 */ @@ -1909,8 +1898,8 @@ export interface typeLiteral< Records extends IndexSignature.Records > extends Schema< - Simplify>, - Simplify>, + Types.Simplify>, + Types.Simplify>, | Struct.Context | IndexSignature.Context > @@ -1918,7 +1907,7 @@ export interface typeLiteral< readonly fields: { readonly [K in keyof Fields]: Fields[K] } readonly records: Readonly annotations( - annotations: Annotations.Schema>> + annotations: Annotations.Schema>> ): typeLiteral } @@ -1929,8 +1918,8 @@ class $typeLiteral< Fields extends Struct.Fields, const Records extends IndexSignature.Records > extends _schema.Schema< - Simplify>, - Simplify>, + Types.Simplify>, + Types.Simplify>, | Struct.Context | IndexSignature.Context > implements typeLiteral { @@ -2022,7 +2011,7 @@ class $typeLiteral< this.records = [...records] as Records } annotations( - annotations: Annotations.Schema>> + annotations: Annotations.Schema>> ): typeLiteral { return new $typeLiteral(this.fields, this.records, _schema.annotations(this.ast, annotations)) } @@ -2033,7 +2022,7 @@ class $typeLiteral< * @since 1.0.0 */ export interface struct extends typeLiteral { - annotations(annotations: Annotations.Schema>>): struct + annotations(annotations: Annotations.Schema>>): struct } /** @@ -2060,7 +2049,7 @@ export interface record extends type readonly key: K readonly value: V annotations( - annotations: Annotations.Schema>> + annotations: Annotations.Schema>> ): record } @@ -2071,7 +2060,7 @@ class $record 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 $record(this.key, this.value, _schema.annotations(this.ast, annotations)) } }