Skip to content

Adopt generic data-layer record types in example apps#874

Draft
amcclain wants to merge 1 commit into
developfrom
data-layer-generics
Draft

Adopt generic data-layer record types in example apps#874
amcclain wants to merge 1 commit into
developfrom
data-layer-generics

Conversation

@amcclain

Copy link
Copy Markdown
Member

Companion to xh/hoist-react#4458 — exercises the new generic GridModel<T> / StoreRecord<T> / Store<T> record types in Toolbox's example apps and tightens their typing along the way.

Changes

  • Threaded record types through the generic GridModel<T> / StoreRecord<T> in the portfolio, recalls, and todo examples (Position, Recall, Task).
  • Moved exported business-concept interfaces (Position, PricedRawPosition, Task) to the top of their files with one-line doc comments; documented Recall.
  • Used import type for the type-only interface imports.
  • Strengthened typing across the todo example: typed all service/model method signatures, added a DueDateGroup union, modeled the persisted StoredTask shape separately from the domain Task, and annotated the boundaries where framework callbacks (RecordAction, CellContext, ag-Grid events, FormModel.values) cannot yet carry the record type.

⚠️ Temporary — to aid review, expected to be removed before merge

  • tsconfig.json has the local hoist-react paths mapping enabled so the app type-checks against the generic data layer in the companion branch. To be reverted once those types ship in a published @xh/hoist snapshot.
  • The extra inline typing comments in the todo example (calling out where as Task casts are needed) exist to highlight where the framework could push generics further. Expected to be trimmed before merge.

Depends on xh/hoist-react#4458.

* Threaded record types through the generic `GridModel<T>` / `StoreRecord<T>` in the portfolio, recalls, and todo examples (`Position`, `Recall`, `Task`).
* Moved exported business-concept interfaces (`Position`, `PricedRawPosition`, `Task`) to the top of their files with one-line doc comments, and documented `Recall`.
* Used `import type` for the type-only interface imports.
* Strengthened typing across the todo example: typed all service/model method signatures, added a `DueDateGroup` union and modeled the persisted `StoredTask` shape separately from the domain `Task`, and annotated the boundaries where framework callbacks (`RecordAction`, `CellContext`, ag-Grid events, `FormModel.values`) cannot yet carry the record type.
* Enabled the local hoist-react `paths` mapping in `tsconfig.json` for the duration of this branch so the app type-checks against the generic data layer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant