/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /// import * as ts from 'typescript/lib/tsserverlibrary'; interface DirectiveClassLike { decoratorId: ts.Identifier; classId: ts.Identifier; } /** * Return metadata about `node` if it looks like an Angular directive class. * In this case, potential matches are `@NgModule`, `@Component`, `@Directive`, * `@Pipe`, etc. * These class declarations all share some common attributes, namely their * decorator takes exactly one parameter and the parameter must be an object * literal. * * For example, * v---------- `decoratorId` * @NgModule({ < * declarations: [], < classDecln-al * }) < * class AppModule {} < * ^----- `classId` * * @param node Potential node that represents an Angular directive. */ export declare function getDirectiveClassLike(node: ts.Node): DirectiveClassLike | undefined; /** * Finds the value of a property assignment that is nested in a TypeScript node and is of a certain * type T. * * @param startNode node to start searching for nested property assignment from * @param propName property assignment name * @param predicate function to verify that a node is of type T. * @return node property assignment value of type T, or undefined if none is found */ export declare function findPropertyValueOfType(startNode: ts.Node, propName: string, predicate: (node: ts.Node) => node is T): T | undefined; /** * Return the node that most tightly encompass the specified `position`. * @param node * @param position */ export declare function findTightestNode(node: ts.Node, position: number): ts.Node | undefined; /** * Returns a property assignment from the assignment value if the property name * matches the specified `key`, or `undefined` if there is no match. */ export declare function getPropertyAssignmentFromValue(value: ts.Node, key: string): ts.PropertyAssignment | undefined; /** * Given the node which is the string of the inline template for a component, returns the * `ts.ClassDeclaration` for the component. */ export declare function getClassDeclOfInlineTemplateNode(templateStringNode: ts.Node): ts.ClassDeclaration | undefined; /** * Given a decorator property assignment, return the ClassDeclaration node that corresponds to the * directive class the property applies to. * If the property assignment is not on a class decorator, no declaration is returned. * * For example, * * @Component({ * template: '
' * ^^^^^^^^^^^^^^^^^^^^^^^---- property assignment * }) * class AppComponent {} * ^---- class declaration node * * @param propAsgnNode property assignment */ export declare function getClassDeclFromDecoratorProp(propAsgnNode: ts.PropertyAssignment): ts.ClassDeclaration | undefined; export {};