Dependency variable

The dependency description for a type-graphql class — the runtime half of this package, for loading dependencies inside a resolver.

Signature:

Dependency: DependencyInterface<any>

Remarks

This looks up a description; it does not define one. Use DependencyFor() to declare loaders, requirements and initializers, and this to reach the load() that resolves them.

It works by mapping the class to the GraphQL type of the same name in DependencyInterface.schema and delegating to Dependency from @imqueue/graphql-dependency. So the class name and the GraphQL type name have to agree: giving @ObjectType an explicit name option that differs from the class name breaks the lookup.

Example

import { Dependency } from '@imqueue/type-graphql-dependency';

// in a resolver, before returning the data
await Dependency(Consumer).load(data, context, fields);

Read this page as plain markdown — no HTML, no navigation. For pasting into an LLM, or for an agent to fetch.