(
type: Type<any>,
propMetadata: {[key: string]: any[]},
isQueryAnn: (ann: any) => ann is Query,
)
| 442 | }; |
| 443 | } |
| 444 | function extractQueriesMetadata( |
| 445 | type: Type<any>, |
| 446 | propMetadata: {[key: string]: any[]}, |
| 447 | isQueryAnn: (ann: any) => ann is Query, |
| 448 | ): R3QueryMetadataFacade[] { |
| 449 | const signalQueriesMeta: R3QueryMetadataFacade[] = []; |
| 450 | const decoratorQueriesMeta: R3QueryMetadataFacade[] = []; |
| 451 | for (const field in propMetadata) { |
| 452 | if (propMetadata.hasOwnProperty(field)) { |
| 453 | const annotations = propMetadata[field]; |
| 454 | annotations.forEach((ann) => { |
| 455 | if (isQueryAnn(ann)) { |
| 456 | if (!ann.selector) { |
| 457 | throw new Error( |
| 458 | `Can't construct a query for the property "${field}" of ` + |
| 459 | `"${stringifyForError(type)}" since the query selector wasn't defined.`, |
| 460 | ); |
| 461 | } |
| 462 | if (annotations.some(isInputAnnotation)) { |
| 463 | throw new Error(`Cannot combine @Input decorators with query decorators`); |
| 464 | } |
| 465 | const queryMeta = convertToR3QueryMetadata(field, ann); |
| 466 | if (queryMeta.isSignal) { |
| 467 | signalQueriesMeta.push(queryMeta); |
| 468 | } else { |
| 469 | decoratorQueriesMeta.push(queryMeta); |
| 470 | } |
| 471 | } |
| 472 | }); |
| 473 | } |
| 474 | } |
| 475 | |
| 476 | // We match the behavior of AOT here by having signal queries first, then the decorator queries. |
| 477 | return [...signalQueriesMeta, ...decoratorQueriesMeta]; |
| 478 | } |
| 479 | |
| 480 | function extractExportAs(exportAs: string | undefined): string[] | null { |
| 481 | return exportAs === undefined ? null : splitByComma(exportAs); |
no test coverage detected
searching dependent graphs…