MCPcopy Create free account
hub / github.com/angular/angular / isStandaloneDecorator

Function isStandaloneDecorator

packages/language-service/src/utils/ts_utils.ts:556–572  ·  view source on GitHub ↗
(decorator: ts.Decorator)

Source from the content-addressed store, hash-verified

554 * Return whether a given Angular decorator specifies `standalone: true`.
555 */
556export function isStandaloneDecorator(decorator: ts.Decorator): boolean | null {
557 const decoratorProps = findFirstMatchingNode(decorator, {filter: ts.isObjectLiteralExpression});
558 if (decoratorProps === null) {
559 return null;
560 }
561
562 for (const property of decoratorProps.properties) {
563 if (!ts.isPropertyAssignment(property)) {
564 continue;
565 }
566 // TODO(dylhunn): What if this is a dynamically evaluated expression?
567 if (property.name.getText() === 'standalone' && property.initializer.getText() === 'false') {
568 return false;
569 }
570 }
571 return true;
572}
573
574/**
575 * Generate a new import. Follows the format:

Callers 1

Calls 2

getTextMethod · 0.80
findFirstMatchingNodeFunction · 0.70

Tested by

no test coverage detected