Как я могу редуцировать-saga.effects.call с клиентом Apollo-Boost - PullRequest
0 голосов
/ 04 февраля 2020

Я хочу применить redux-saga из-за обработки исключений.

function * createFolderSaga(workspaceId: number, parentId: number, userId: number, folderName: string) {
  try {
    const createFolder = client.mutate<Mutation>({
      mutation: CREATE_FOLDER,
      variables: {
        workspaceId: workspaceId,
        parentFolderId: parentId,
        userId: userId,
        title: folderName,
      },
    })
    yield call(createFolder) // Type error
  } catch (e) {

  }
}

Сообщение об ошибке

const createFolder: Promise<FetchResult<Mutation, Record<string, any>, Record<string, any>>>
No overload matches this call.
  The last overload gave the following error.
    Argument of type 'Promise<FetchResult<Mutation, Record<string, any>, Record<string, any>>>' is not assignable to parameter of type '{ context: unknown; fn: (this: unknown, ...args: any[]) => any; }'.
      Type 'Promise<FetchResult<Mutation, Record<string, any>, Record<string, any>>>' is missing the following properties from type '{ context: unknown; fn: (this: unknown, ...args: any[]) => any; }': context, fnts(2769)
effects.d.ts(499, 17): The last overload is declared here.

Я знаю, что call () - это объект обещания в качестве аргумента. Затем apollo-client вернет объект обещания. В чем проблема? Как я могу решить проблему?

...