public resolveAll()

in src/dependency-container.ts [333:360]


  public resolveAll<T>(
    token: InjectionToken<T>,
    context: ResolutionContext = new ResolutionContext()
  ): T[] {
    const registrations = this.getAllRegistrations(token);

    if (!registrations && isNormalToken(token)) {
      throw new Error(
        `Attempted to resolve unregistered dependency token: "${token.toString()}"`
      );
    }

    this.executePreResolutionInterceptor(token, "All");

    if (registrations) {
      const result = registrations.map(item =>
        this.resolveRegistration<T>(item, context)
      );

      this.executePostResolutionInterceptor(token, result, "All");
      return result;
    }

    // No registration for this token, but since it's a constructor, return an instance
    const result = [this.construct(token as constructor<T>, context)];
    this.executePostResolutionInterceptor(token, result, "All");
    return result;
  }