source: trip-planner-front/node_modules/@angular/compiler-cli/src/ngtsc/typecheck/extended/api/api.d.ts@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.2 KB
Line 
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/compiler-cli/src/ngtsc/typecheck/extended/api/api" />
9import { AST, TmplAstNode } from '@angular/compiler';
10import * as ts from 'typescript';
11import { ErrorCode } from '../../../diagnostics';
12import { NgTemplateDiagnostic, TemplateTypeChecker } from '../../api';
13/**
14 * A Template Check receives information about the template it's checking and returns
15 * information about the diagnostics to be generated.
16 */
17export interface TemplateCheck<T extends ErrorCode> {
18 /** Unique template check code, used for configuration and searching the error. */
19 code: T;
20 /** Runs check and returns information about the diagnostics to be generated. */
21 run(ctx: TemplateContext, component: ts.ClassDeclaration, template: TmplAstNode[]): NgTemplateDiagnostic<T>[];
22}
23/**
24 * The TemplateContext provided to a Template Check to get diagnostic information.
25 */
26export interface TemplateContext {
27 /** Interface that provides information about template nodes. */
28 templateTypeChecker: TemplateTypeChecker;
29 /**
30 * TypeScript interface that provides type information about symbols that appear
31 * in the template (it is not to query types outside the Angular component).
32 */
33 typeChecker: ts.TypeChecker;
34}
35/**
36 * This abstract class provides a base implementation for the run method.
37 */
38export declare abstract class TemplateCheckWithVisitor<T extends ErrorCode> implements TemplateCheck<T> {
39 abstract code: T;
40 /**
41 * Base implementation for run function, visits all nodes in template and calls
42 * `visitNode()` for each one.
43 */
44 run(ctx: TemplateContext, component: ts.ClassDeclaration, template: TmplAstNode[]): NgTemplateDiagnostic<T>[];
45 /**
46 * Visit a TmplAstNode or AST node of the template. Authors should override this
47 * method to implement the check and return diagnostics.
48 */
49 abstract visitNode(ctx: TemplateContext, component: ts.ClassDeclaration, node: TmplAstNode | AST): NgTemplateDiagnostic<T>[];
50}
Note: See TracBrowser for help on using the repository browser.