-
Notifications
You must be signed in to change notification settings - Fork 10
Closed
Description
Problem
My queryFn
returned promise.t has a result<'a, 'e>
, but I 'queryError
is completely disassociated.
queryFn: ReactQuery_Types.queryFunctionContext<'queryKey, 'pageParam> => Js.Promise.t<'queryData>
Discussion
As rescript users denote, Js.Promise
is more or less worthless for modelling error types, which turns out is pretty critical for JS applications.
I'm currently using aantron/promise which at runtime is the practical mapping between this library's 'queryError
and my 'e
of result<'a, 'e>
. The same could be said for ryyppy's or yawaramin's promise impl's as well.
I'm curious if there's a way to abstract the types here to satisfy the status quo, but also play nicely with result
aware promise impls that care about modelling the error case. perhaps a GADT on the return type could be applicable and processed accordingly in the the useQuery impl?
Metadata
Metadata
Assignees
Labels
No labels