hoist-react icon indicating copy to clipboard operation
hoist-react copied to clipboard

Support `Store` generic types to spec types for `StoreRecord.data` and `StoreRecord.id`

Open amcclain opened this issue 8 months ago • 1 comments

It would be excellent if we could spec an interface for the data element of all records within a given Store, so you would have type-aware support when reading their data in code.

Have not thought it through in detail, but I am assuming StoreRecord would take a generic and then Store, GridModel, etc. would have some way to pass it though. And of course it would need to come out the other side of a variety of StoreRecord-emitting APIs. But I believe it would be a big win, given how common it is to pass records around through an application.

Being able to tell TS that your ids will be either numbers or strings (as opposed to either) could also eliminate some common boilerplate casting.

amcclain avatar Jun 12 '24 00:06 amcclain