MCPcopy
hub / github.com/nestjs/nest / get

Method get

packages/core/nest-application-context.ts:165–175  ·  view source on GitHub ↗

* Retrieves an instance (or a list of instances) of either injectable or controller, otherwise, throws exception. * @returns {TResult | Array<TResult>}

(
    typeOrToken: Type<TInput> | Abstract<TInput> | string | symbol,
    options: GetOrResolveOptions = { strict: false },
  )

Source from the content-addressed store, hash-verified

163 * @returns {TResult | Array<TResult>}
164 */
165 public get<TInput = any, TResult = TInput>(
166 typeOrToken: Type<TInput> | Abstract<TInput> | string | symbol,
167 options: GetOrResolveOptions = { strict: false },
168 ): TResult | Array<TResult> {
169 return !(options && options.strict)
170 ? this.find<TInput, TResult>(typeOrToken, options)
171 : this.find<TInput, TResult>(typeOrToken, {
172 moduleId: this.contextModule?.id,
173 each: options.each,
174 });
175 }
176
177 /**
178 * Resolves transient or request-scoped instance of either injectable or controller, otherwise, throws exception.

Callers

nothing calls this directly

Calls 1

findMethod · 0.45

Tested by

no test coverage detected