# InjectorDependency

**Kind:** Type

**Source:** [`packages/core/injector/injector.ts`](https://github.com/nestjs/nest/blob/master/packages/core/injector/injector.ts#L51)

**Part of:** [Core](subsystem-packages-core)

The type of an injectable dependency

`InjectorDependency` represents a value that can be requested from the dependency injector. It is used when declaring or passing dependency requirements so the injector can identify the appropriate provider and resolve an instance at runtime. This type keeps dependency declarations consistent across injector registration and resolution APIs.

## Definition

```ts
InjectionToken
```

## Diagram

```mermaid
graph LR
  Consumer[Consumer / Service] --> Dependency[InjectorDependency]
  Dependency --> Injector[Injector]
  Injector --> Provider[Registered Provider]
  Provider --> Instance[Resolved Instance]
  Instance --> Consumer
```

## Usage

```ts
import type { InjectorDependency } from './injector';

class Logger {
  log(message: string): void {
    console.log(message);
  }
}

// A class/token that can be resolved by the injector.
const loggerDependency: InjectorDependency = Logger;

function requiresDependency(dependency: InjectorDependency) {
  return dependency;
}

requiresDependency(loggerDependency);
```

## AI Coding Instructions

- Use `InjectorDependency` for values passed to injector APIs that represent a dependency requirement or provider lookup key.
- Prefer declared service classes or supported injection tokens rather than ad hoc string values unless the surrounding injector API explicitly supports them.
- Keep dependency declarations aligned with registered providers; an unresolved dependency will fail when the injector attempts resolution.
- Import this type with `import type` when it is only used for TypeScript annotations.

## Relationships

- IMPORTS → `InjectionToken`
- IMPORTS → `Logger`
- IMPORTS → `LoggerService`
- IMPORTS → `OptionalFactoryDependency`
- IMPORTS → `Scope`
- IMPORTS → `OPTIONAL_DEPS_METADATA`
- IMPORTS → `OPTIONAL_PROPERTY_DEPS_METADATA`
- IMPORTS → `PARAMTYPES_METADATA`
- IMPORTS → `PROPERTY_DEPS_METADATA`
- IMPORTS → `SELF_DECLARED_DEPS_METADATA`
- IMPORTS → `Controller`
- IMPORTS → `ForwardReference`
- IMPORTS → `Injectable`
- IMPORTS → `Type`
- IMPORTS → `isFunction`
- IMPORTS → `isNil`
- IMPORTS → `isObject`
- IMPORTS → `isString`
- IMPORTS → `isSymbol`
- IMPORTS → `isUndefined`
