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

Function isStandaloneDecorator

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

Source from the content-addressed store, hash-verified

584 * Return whether a given Angular decorator specifies `standalone: true`.
585 */
586export function isStandaloneDecorator(decorator: ts.Decorator): boolean | null {
587 const decoratorProps = findFirstMatchingNode(decorator, {filter: ts.isObjectLiteralExpression});
588 if (decoratorProps === null) {
589 return null;
590 }
591
592 for (const property of decoratorProps.properties) {
593 if (!ts.isPropertyAssignment(property)) {
594 continue;
595 }
596 // TODO(dylhunn): What if this is a dynamically evaluated expression?
597 if (property.name.getText() === 'standalone' && property.initializer.getText() === 'false') {
598 return false;
599 }
600 }
601 return true;
602}
603
604/**
605 * Generate a new import. Follows the format:

Callers 1

Calls 2

getTextMethod · 0.80
findFirstMatchingNodeFunction · 0.70

Tested by

no test coverage detected