Skip to content

Commit

Permalink
Satisfy OperationVariables constraint on generic
Browse files Browse the repository at this point in the history
Building the front with Bun fails with the following error:
```
TS2344: Type 'U' does not satisfy the constraint 'OperationVariables'.
     5 |
     6 | export function wrapQuery<D, T, U>(
  >  7 |   query: UseQueryReturn<T, U>,
       |                            ^
     8 |   def: D,
     9 |   wrapper: (data: DeepRequired<DeepNonNullable<T>>) => D
    10 | ) {
```

This is due to an upstream type change in @apollo/client@3.7.6.
  • Loading branch information
erdnaxe committed Feb 20, 2024
1 parent dbccf16 commit ee31522
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion front/src/ctfnote/utils.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { OperationVariables } from '@apollo/client/core';
import { UseQueryReturn, useResult } from '@vue/apollo-composable';
import ColorHash from 'color-hash';
import { DeepNonNullable, DeepRequired } from 'ts-essentials';
import { inject, InjectionKey, Ref } from 'vue';

export function wrapQuery<D, T, U>(
export function wrapQuery<D, T, U extends OperationVariables>(
query: UseQueryReturn<T, U>,
def: D,
wrapper: (data: DeepRequired<DeepNonNullable<T>>) => D
Expand Down

0 comments on commit ee31522

Please sign in to comment.