# DataInitializer type · @imqueue/graphql-dependency

Source: https://imqueue.org/api/graphql-dependency/latest/graphql-dependency.datainitializer/
Published: 2026-07-31
Author: @imqueue maintainers (https://github.com/imqueue)
Package: @imqueue/graphql-dependency 3.1.0 — generated reference, not hand-written

An async routine that fills extra fields onto a type's own objects before its dependencies load, registered with `defineInitializer()`.

**Signature:**

```typescript
export type DataInitializer<T> = (context: any, result: T, fields?: any) => Promise<DataInitializerResult>;
```
**References:** [DataInitializerResult](https://imqueue.org/api/graphql-dependency/latest/graphql-dependency.datainitializerresult/)

## Remarks

Its job is to supply what a dependency filter needs but the initial result does not carry — foreign ids that have to be fetched or derived first, for instance. It is handed the resolver context, the objects loaded so far, and the fields the request asked for, and returns a map keyed by object id.

