(type: Type<any>, suppressErrors: boolean)
| 359 | } |
| 360 | |
| 361 | function verifyDeclarationIsUnique(type: Type<any>, suppressErrors: boolean) { |
| 362 | type = resolveForwardRef(type); |
| 363 | const existingModule = ownerNgModule.get(type); |
| 364 | if (existingModule && existingModule !== moduleType) { |
| 365 | if (!suppressErrors) { |
| 366 | const modules = [existingModule, moduleType].map(stringifyForError).sort(); |
| 367 | errors.push( |
| 368 | `Type ${stringifyForError(type)} is part of the declarations of 2 modules: ${ |
| 369 | modules[0] |
| 370 | } and ${modules[1]}! ` + |
| 371 | `Please consider moving ${stringifyForError(type)} to a higher module that imports ${ |
| 372 | modules[0] |
| 373 | } and ${modules[1]}. ` + |
| 374 | `You can also create a new NgModule that exports and includes ${stringifyForError( |
| 375 | type, |
| 376 | )} then import that NgModule in ${modules[0]} and ${modules[1]}.`, |
| 377 | ); |
| 378 | } |
| 379 | } else { |
| 380 | // Mark type as having owner. |
| 381 | ownerNgModule.set(type, moduleType); |
| 382 | } |
| 383 | } |
| 384 | |
| 385 | function verifyComponentIsPartOfNgModule(type: Type<any>) { |
| 386 | type = resolveForwardRef(type); |
no test coverage detected