A CQRS-flavoured data fetching and caching layer in TypeScript. Batching, caching, data-dependencies and manual invalidations in a declarative fashion for Node and the browser
Given how types are written at the moment, the resulting doAddUser will return a TaskEither<unknown, string> because the resulting L is computed as CmdL | InvaldiationsL, and 'generic' | 'specific' | unknown is just = unknown
This is desired in general (and you can always spot it downstream when you are not able e.g. to be exhaustive in matching the error). But at the same time, it is currently hard/impossible to make the invalidations L more specific without changing the original query logic.
I think adding a mapLeft on Query would allow to use it inline when needed from command declarations, e.g.:
While doing some backporting, I came across some instances of
command
s that are:L
, e.g.'generic' | 'specific'
L
, likeunknown
E.g.
Given how types are written at the moment, the resulting
doAddUser
will return aTaskEither<unknown, string>
because the resultingL
is computed asCmdL | InvaldiationsL
, and'generic' | 'specific' | unknown
is just =unknown
This is desired in general (and you can always spot it downstream when you are not able e.g. to be exhaustive in matching the error). But at the same time, it is currently hard/impossible to make the invalidations
L
more specific without changing the original query logic.I think adding a
mapLeft
onQuery
would allow to use it inline when needed from command declarations, e.g.: