# @types/graphql-resolve-batch

> TypeScript definitions for graphql-resolve-batch

Latest version **1.1.11** (published 2023-11-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/graphql-resolve-batch
pnpm add @types/graphql-resolve-batch
yarn add @types/graphql-resolve-batch
bun add @types/graphql-resolve-batch
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.1.11 |
| Published | 2023-11-21 |
| First published | 2018-02-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51443 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/graphql-resolve-batch
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/graphql-resolve-batch
- npm.io page: https://npm.io/package/@types/graphql-resolve-batch

## Dependencies (1)

- [graphql](https://npm.io/package/graphql.md) >=14

## Recent versions

- 1.1.11 (latest) — 2023-11-21
- 1.1.6 (ts4.1) — 2022-05-12
- 1.1.5 (ts2.6) — 2019-08-26
- 1.1.2 (ts2.3) — 2018-08-15
- 1.1.10 — 2023-11-07
- 1.1.9 — 2023-10-18
- 1.1.8 — 2023-10-10
- 1.1.7 — 2023-09-20
- 1.1.4 — 2019-08-23
- 1.1.3 — 2018-10-16
- 1.1.1 — 2018-03-15
- 1.1.0 — 2018-03-08
- 1.0.0 — 2018-02-17

## README

# Installation
> `npm install --save @types/graphql-resolve-batch`

# Summary
This package contains type definitions for graphql-resolve-batch (https://github.com/calebmer/graphql-resolve-batch#readme).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/graphql-resolve-batch.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/graphql-resolve-batch/index.d.ts)
````ts
import { GraphQLResolveInfo } from "graphql";

/**
 * Creates a GraphQL.js field resolver that batches together multiple resolves
 * together that share the *exact* same GraphQL field selection.
 *
 * Note:
 *  The batchResolveFunction you supply always expects you to return an array of TReturn (or a promise with this array).
 *  This is because you will have to return a TReturn for every source given to you by the batch function.
 *  For an example of this please see the examples in the original project repository:
 *  https://github.com/calebmer/graphql-resolve-batch/tree/master/examples
 *
 * @template TSource The original type of a single source.
 * @template TReturn The return type of the field resolver.
 * @template TArgs The type of supplied arguments.
 * @template TContext The type of the current resolver context.
 * @param batchResolveFn A batch function to resolve all fields for the given sources in a single batch.
 */
export function createBatchResolver<
    TSource,
    TReturn,
    TArgs = any,
    TContext = any,
>(
    batchResolveFn: BatchResolveFunction<TSource, TArgs, TContext, TReturn>,
): ResolverFunction<TSource, TArgs, TContext, TReturn>;

/**
 * The resulting field resolver that batches together multiple resolves.
 * Graphql-resolve-batch will always return a promise for this resulting resolver.
 */
export type ResolverFunction<TSource, TArgs, TContext, TReturn> = (
    source: TSource,
    args: TArgs,
    context: TContext,
    info: GraphQLResolveInfo,
) => Promise<TReturn>;

/**
 * A batch function to resolve all fields for the given sources in a single batch.
 */
export type BatchResolveFunction<TSource, TArgs, TContext, TReturn> = (
    sources: readonly TSource[],
    args: TArgs,
    context: TContext,
    info: GraphQLResolveInfo,
) => TReturn[] | Promise<TReturn[]>;

````

### Additional Details
 * Last updated: Mon, 20 Nov 2023 23:36:24 GMT
 * Dependencies: [graphql](https://npmjs.com/package/graphql)

# Credits
These definitions were written by [Rutger Hendrickx](https://github.com/nayni).

---
_Source: https://npm.io/package/@types/graphql-resolve-batch · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
