# GetOrResolveOptions

**Kind:** Interface

**Source:** [`packages/common/interfaces/nest-application-context.interface.ts`](https://github.com/nestjs/nest/blob/master/packages/common/interfaces/nest-application-context.interface.ts#L10)

**Part of:** [Common](subsystem-packages-common)

`GetOrResolveOptions` configures how a Nest application context looks up or resolves providers. Use `strict` to control whether resolution is limited to the current module context, and `each` to request all matching provider instances instead of a single result.

## Properties

| Property | Type |
|---|---|
| `strict` | `boolean` |
| `each` | `boolean` |

## Diagram

```mermaid
graph LR
  A[Application Context] --> B[GetOrResolveOptions]
  B --> C[strict: boolean]
  B --> D[each: boolean]
  C --> E[Limit lookup to current module context]
  D --> F[Return one or all matching providers]
```

## Usage

```ts
import { NestFactory } from '@nestjs/core';
import { GetOrResolveOptions } from '@nestjs/common';

const options: GetOrResolveOptions = {
  strict: false,
  each: true,
};

const app = await NestFactory.createApplicationContext(AppModule);

// Search across module boundaries and return every matching provider.
const handlers = app.get(MyHandlerToken, options);

handlers.forEach((handler) => handler.handle());
```

## AI Coding Instructions

- Set `strict: true` when a provider must be resolved only from the current module context.
- Use `strict: false` for cross-module provider lookup when providers are exported through imported modules.
- Set `each: true` only when multiple providers may share the requested token; handle the returned collection accordingly.
- Keep provider tokens and expected return types aligned, especially when using custom injection tokens.
- Prefer explicit options when lookup behavior is important to avoid unintended module-boundary resolution.

## Used by

2 references from 2 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

### Imported by (2)

- `AbstractInstanceResolver` — `packages/core/injector/abstract-instance-resolver.ts`:12
- `NestApplicationContext` — `packages/core/nest-application-context.ts`:40
