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

Function verifyDeclarationIsUnique

packages/core/src/render3/jit/module.ts:346–368  ·  view source on GitHub ↗
(type: Type<any>, suppressErrors: boolean)

Source from the content-addressed store, hash-verified

344 }
345
346 function verifyDeclarationIsUnique(type: Type<any>, suppressErrors: boolean) {
347 type = resolveForwardRef(type);
348 const existingModule = ownerNgModule.get(type);
349 if (existingModule && existingModule !== moduleType) {
350 if (!suppressErrors) {
351 const modules = [existingModule, moduleType].map(stringifyForError).sort();
352 errors.push(
353 `Type ${stringifyForError(type)} is part of the declarations of 2 modules: ${
354 modules[0]
355 } and ${modules[1]}! ` +
356 `Please consider moving ${stringifyForError(type)} to a higher module that imports ${
357 modules[0]
358 } and ${modules[1]}. ` +
359 `You can also create a new NgModule that exports and includes ${stringifyForError(
360 type,
361 )} then import that NgModule in ${modules[0]} and ${modules[1]}.`,
362 );
363 }
364 } else {
365 // Mark type as having owner.
366 ownerNgModule.set(type, moduleType);
367 }
368 }
369
370 function verifyComponentIsPartOfNgModule(type: Type<any>) {
371 type = resolveForwardRef(type);

Callers 1

Calls 6

resolveForwardRefFunction · 0.90
stringifyForErrorFunction · 0.90
mapMethod · 0.80
getMethod · 0.65
setMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…