Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#3133·urql

Suggestion: Export withPromise for easier typing in typescript tests

Author: probablykabariCreated Apr 5, 2023Updated Apr 7, 2023
Labelsfuture 🔮

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>:

typescript
   // 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.

Source: urql-graphql/urql

View original on GitHubView discussion on GitHub