UNPKG

2.56 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8/// <amd-module name="@angular/language-service/src/template" />
9import * as ts from 'typescript';
10import * as ng from './types';
11import { TypeScriptServiceHost } from './typescript_host';
12/**
13 * A base class to represent a template and which component class it is
14 * associated with. A template source could answer basic questions about
15 * top-level declarations of its class through the members() and query()
16 * methods.
17 */
18declare abstract class BaseTemplate implements ng.TemplateSource {
19 private readonly host;
20 private readonly classDeclNode;
21 private readonly classSymbol;
22 private readonly program;
23 private membersTable;
24 private queryCache;
25 constructor(host: TypeScriptServiceHost, classDeclNode: ts.ClassDeclaration, classSymbol: ng.StaticSymbol);
26 abstract get span(): ng.Span;
27 abstract get fileName(): string;
28 abstract get source(): string;
29 /**
30 * Return the Angular StaticSymbol for the class that contains this template.
31 */
32 get type(): ng.StaticSymbol;
33 /**
34 * Return a Map-like data structure that allows users to retrieve some or all
35 * top-level declarations in the associated component class.
36 */
37 get members(): ng.SymbolTable;
38 /**
39 * Return an engine that provides more information about symbols in the
40 * template.
41 */
42 get query(): ng.SymbolQuery;
43}
44/**
45 * An InlineTemplate represents template defined in a TS file through the
46 * `template` attribute in the decorator.
47 */
48export declare class InlineTemplate extends BaseTemplate {
49 readonly fileName: string;
50 readonly source: string;
51 readonly span: ng.Span;
52 constructor(templateNode: ts.StringLiteralLike, classDeclNode: ts.ClassDeclaration, classSymbol: ng.StaticSymbol, host: TypeScriptServiceHost);
53}
54/**
55 * An ExternalTemplate represents template defined in an external (most likely
56 * HTML, but not necessarily) file through the `templateUrl` attribute in the
57 * decorator.
58 * Note that there is no ts.Node associated with the template because it's not
59 * a TS file.
60 */
61export declare class ExternalTemplate extends BaseTemplate {
62 readonly source: string;
63 readonly fileName: string;
64 readonly span: ng.Span;
65 constructor(source: string, fileName: string, classDeclNode: ts.ClassDeclaration, classSymbol: ng.StaticSymbol, host: TypeScriptServiceHost);
66}
67export {};