urql icon indicating copy to clipboard operation
urql copied to clipboard

Suggestion: Export withPromise for easier typing in typescript tests

Open probablykabari opened this issue 1 year ago • 2 comments

https://github.com/urql-graphql/urql/blob/9cdb74b03e07d46e056ef023d1543f24a823ec55/packages/core/src/utils/streamUtils.ts

If you're coming from v3 -> v4 in typescript the following results in a type error because this is a Source<OperationResult> instead of OperationResultSource<OperationResult>:

   // on a mock Urql client
    executeQuery: () => {
       const result = makeResult(....) // OperationResult
        return fromValue(result) // Source<OperationResult>
    };

It's a small thing but I think it is better to have access to the util than use as OperationResultSource<OperationResult> for anyone consuming the library.

probablykabari avatar Apr 05 '23 21:04 probablykabari