Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 0 additions & 35 deletions .changeset/union-no-class-form.md

This file was deleted.

36 changes: 36 additions & 0 deletions packages/entity/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,41 @@
# @btravstack/entity

## 0.7.0

### Minor Changes

- 5844dd4: `Entity.union(...)` returns a value, not a class.

## Breaking: the class form is gone

```ts
// before
class Payment extends Entity.union("method", [Card, BankTransfer]) {}

// after
export const Payment = Entity.union("method", [Card, BankTransfer]);
export type Payment = Entity.Instance<typeof Payment>;
```

The class form typed as the members' shared _root_, not as the member union, so
it could not narrow — and it failed late, at the first call site that touched a
member-only field. A class's instance type cannot be a union (`TS2509`), so no
version of it could have narrowed; and its type was always redundant with the
root the author had already named. `class X extends Entity.union(...) {}` is now
`TS2507` at the declaration.

Statics that lived in the class body become plain functions:

```ts
export const parsePayment = (row: unknown) => Payment.make(row);
```

## Breaking: `__base` is removed

The phantom `__base` carrier is gone from `EntityStatic` and `UnionMember`. It
existed only to compute the class form's root type. Nothing writes it by hand;
it is listed because it is part of the emitted public surface.

## 0.6.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/entity/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@btravstack/entity",
"version": "0.6.0",
"version": "0.7.0",
"description": "A domain-entity builder on zod v4: branded fields, immutable data, sealed construction, and Result instead of throws",
"keywords": [
"ddd",
Expand Down
Loading