where the type of activitiesData is { activitiesById: Record<ID, ActivityWithIds> } and likewise for tasksData,
I've decided that it's much less mental overhead and also less implementation hassle to simply return things like
{ byId: tasksById }
from the backend, that way the Data type we use is the only typing we need to do for this, and we never have to think about what properties to use, etc., and we can always expect that thing.byId will work for things that come from the backend as objects grouped by ID.
This closes #62 as obsolete.
I also added a DataById type to prevent having to rewrite Data<"byId", ById<ThingWithIds[]>> over and over.
Instead of creating a complicated TypeScript helper function that extracts the entries generally, e.g. like
where the type of
activitiesData
is{ activitiesById: Record<ID, ActivityWithIds> }
and likewise fortasksData
,I've decided that it's much less mental overhead and also less implementation hassle to simply return things like
from the backend, that way the
Data
type we use is the only typing we need to do for this, and we never have to think about what properties to use, etc., and we can always expect thatthing.byId
will work for things that come from the backend as objects grouped by ID.This closes #62 as obsolete.
I also added a
DataById
type to prevent having to rewriteData<"byId", ById<ThingWithIds[]>>
over and over.