MCPcopy Index your code
hub / github.com/angular/angular / validateProvider

Function validateProvider

packages/core/src/di/provider_collection.ts:365–386  ·  view source on GitHub ↗
(
  provider: SingleProvider,
  providers: Array<SingleProvider | InternalEnvironmentProviders>,
  containerType: Type<unknown>,
)

Source from the content-addressed store, hash-verified

363}
364
365function validateProvider(
366 provider: SingleProvider,
367 providers: Array<SingleProvider | InternalEnvironmentProviders>,
368 containerType: Type<unknown>,
369): void {
370 if (
371 isTypeProvider(provider) ||
372 isValueProvider(provider) ||
373 isFactoryProvider(provider) ||
374 isExistingProvider(provider)
375 ) {
376 return;
377 }
378
379 // Here we expect the provider to be a `useClass` provider (by elimination).
380 const classRef = resolveForwardRef(
381 provider && ((provider as StaticClassProvider | ClassProvider).useClass || provider.provide),
382 );
383 if (!classRef) {
384 throwInvalidProviderError(containerType, providers, provider);
385 }
386}
387
388function deepForEachProvider(
389 providers: Array<Provider | InternalEnvironmentProviders>,

Callers 2

walkProviderTreeFunction · 0.85

Calls 6

resolveForwardRefFunction · 0.90
isTypeProviderFunction · 0.85
isValueProviderFunction · 0.85
isFactoryProviderFunction · 0.85
isExistingProviderFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…