From 3612d363a780b85966ad0324b680196710efcf9f Mon Sep 17 00:00:00 2001 From: Graeme Foster <80714+GraemeF@users.noreply.github.com> Date: Mon, 19 Oct 2026 06:54:39 +0100 Subject: [PATCH 1/2] fix(eventsourcing-store): declare the test suite's example event as a plain type --- .changeset/test-suite-plain-event-type.md | 5 +++++ .../src/lib/testing/eventstore-test-suite.ts | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 .changeset/test-suite-plain-event-type.md diff --git a/.changeset/test-suite-plain-event-type.md b/.changeset/test-suite-plain-event-type.md new file mode 100644 index 00000000..309a6bf3 --- /dev/null +++ b/.changeset/test-suite-plain-event-type.md @@ -0,0 +1,5 @@ +--- +'@codeforbreakfast/eventsourcing-store': patch +--- + +The event store test suite now passes lint under typescript-eslint 8.71.2. Its example event is a plain type rather than one derived from an unused schema. Nothing changes in what the suite exports or tests. diff --git a/packages/eventsourcing-store/src/lib/testing/eventstore-test-suite.ts b/packages/eventsourcing-store/src/lib/testing/eventstore-test-suite.ts index 96da5dfd..a5bfe564 100644 --- a/packages/eventsourcing-store/src/lib/testing/eventstore-test-suite.ts +++ b/packages/eventsourcing-store/src/lib/testing/eventstore-test-suite.ts @@ -24,8 +24,7 @@ const Id = { export const newEventStreamId = () => pipe(`stream_${Id.randomPart()}`, Schema.decode(EventStreamId)); -const FooEvent = Schema.Struct({ bar: Schema.String }); -type FooEvent = typeof FooEvent.Type; +type FooEvent = { readonly bar: string }; const readStreamFromBeginning = (streamId: Effect.Effect) => From 393ea2156e3ceac16305332830f0352cfa8a489d Mon Sep 17 00:00:00 2001 From: Graeme Foster <80714+GraemeF@users.noreply.github.com> Date: Mon, 19 Oct 2026 15:22:50 +0100 Subject: [PATCH 2/2] fix(eventsourcing-aggregates): declare type-only example events as plain types --- .changeset/test-suite-plain-event-type.md | 3 ++- .../src/lib/aggregate-load.test.ts | 15 +++-------- .../src/lib/command-processing-example.ts | 26 +++++-------------- .../src/lib/command-processing.test.ts | 23 +++++----------- 4 files changed, 18 insertions(+), 49 deletions(-) diff --git a/.changeset/test-suite-plain-event-type.md b/.changeset/test-suite-plain-event-type.md index 309a6bf3..e8e94000 100644 --- a/.changeset/test-suite-plain-event-type.md +++ b/.changeset/test-suite-plain-event-type.md @@ -1,5 +1,6 @@ --- +'@codeforbreakfast/eventsourcing-aggregates': patch '@codeforbreakfast/eventsourcing-store': patch --- -The event store test suite now passes lint under typescript-eslint 8.71.2. Its example event is a plain type rather than one derived from an unused schema. Nothing changes in what the suite exports or tests. +The event store test suite and the command processing example now pass lint under typescript-eslint 8.71.2. Their example events are plain types rather than types derived from schemas that were never used at runtime. Nothing changes in what either package exports or does. diff --git a/packages/eventsourcing-aggregates/src/lib/aggregate-load.test.ts b/packages/eventsourcing-aggregates/src/lib/aggregate-load.test.ts index b800dead..6d8f4a1d 100644 --- a/packages/eventsourcing-aggregates/src/lib/aggregate-load.test.ts +++ b/packages/eventsourcing-aggregates/src/lib/aggregate-load.test.ts @@ -23,18 +23,9 @@ interface TestAggregateState { readonly count: number; } -const TestEventCreated = Schema.Struct({ - type: Schema.Literal('TestCreated'), - data: Schema.Struct({ value: Schema.String }), -}); - -const TestEventIncremented = Schema.Struct({ - type: Schema.Literal('TestIncremented'), - data: Schema.Struct({}), -}); - -const TestEvent = Schema.Union(TestEventCreated, TestEventIncremented); -type TestEvent = Schema.Schema.Type; +type TestEvent = + | { readonly type: 'TestCreated'; readonly data: { readonly value: string } } + | { readonly type: 'TestIncremented'; readonly data: Readonly> }; const applyTestEvent = (state: Readonly>) => diff --git a/packages/eventsourcing-aggregates/src/lib/command-processing-example.ts b/packages/eventsourcing-aggregates/src/lib/command-processing-example.ts index eb4cdd16..56462b4d 100644 --- a/packages/eventsourcing-aggregates/src/lib/command-processing-example.ts +++ b/packages/eventsourcing-aggregates/src/lib/command-processing-example.ts @@ -1,4 +1,4 @@ -import { Effect, Layer, pipe, Schema, Context } from 'effect'; +import { Effect, Layer, pipe, Context } from 'effect'; import type { ReadonlyDeep } from 'type-fest'; import { CommandProcessingService, @@ -20,24 +20,12 @@ import { // ============================================================================ // Example: Define your domain-specific events -const UserCreated = Schema.Struct({ - type: Schema.Literal('UserCreated'), - data: Schema.Struct({ - name: Schema.String, - email: Schema.String, - }), -}); - -const UserUpdated = Schema.Struct({ - type: Schema.Literal('UserUpdated'), - data: Schema.Struct({ - name: Schema.String, - }), -}); - -// Example: Union of all user events -const UserEvent = Schema.Union(UserCreated, UserUpdated); -type UserEvent = typeof UserEvent.Type; +type UserEvent = + | { + readonly type: 'UserCreated'; + readonly data: { readonly name: string; readonly email: string }; + } + | { readonly type: 'UserUpdated'; readonly data: { readonly name: string } }; // Example: Create a domain-specific event store tag const UserEventStore = Context.GenericTag, EventStore>( diff --git a/packages/eventsourcing-aggregates/src/lib/command-processing.test.ts b/packages/eventsourcing-aggregates/src/lib/command-processing.test.ts index 0a6c9e3b..0a38ca1f 100644 --- a/packages/eventsourcing-aggregates/src/lib/command-processing.test.ts +++ b/packages/eventsourcing-aggregates/src/lib/command-processing.test.ts @@ -31,23 +31,12 @@ const isUnknownError: ( ) => error is Extract = Schema.is(UnknownErrorSchema); -const UserCreated = Schema.Struct({ - type: Schema.Literal('UserCreated'), - data: Schema.Struct({ - name: Schema.String, - email: Schema.String, - }), -}); - -const OrderCreated = Schema.Struct({ - type: Schema.Literal('OrderCreated'), - data: Schema.Struct({ - orderId: Schema.String, - }), -}); - -const TestEvent = Schema.Union(UserCreated, OrderCreated); -type TestEvent = typeof TestEvent.Type; +type TestEvent = + | { + readonly type: 'UserCreated'; + readonly data: { readonly name: string; readonly email: string }; + } + | { readonly type: 'OrderCreated'; readonly data: { readonly orderId: string } }; const TestEventStore = Context.GenericTag, EventStore>( 'TestEventStore'