UNPKG

9.49 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/compiler-cli/src/ngtsc/diagnostics/src/error_code" />
9/**
10 * @publicApi
11 */
12export declare enum ErrorCode {
13 DECORATOR_ARG_NOT_LITERAL = 1001,
14 DECORATOR_ARITY_WRONG = 1002,
15 DECORATOR_NOT_CALLED = 1003,
16 DECORATOR_UNEXPECTED = 1005,
17 /**
18 * This error code indicates that there are incompatible decorators on a type or a class field.
19 */
20 DECORATOR_COLLISION = 1006,
21 VALUE_HAS_WRONG_TYPE = 1010,
22 VALUE_NOT_LITERAL = 1011,
23 COMPONENT_MISSING_TEMPLATE = 2001,
24 PIPE_MISSING_NAME = 2002,
25 PARAM_MISSING_TOKEN = 2003,
26 DIRECTIVE_MISSING_SELECTOR = 2004,
27 /** Raised when an undecorated class is passed in as a provider to a module or a directive. */
28 UNDECORATED_PROVIDER = 2005,
29 /**
30 * Raised when a Directive inherits its constructor from a base class without an Angular
31 * decorator.
32 */
33 DIRECTIVE_INHERITS_UNDECORATED_CTOR = 2006,
34 /**
35 * Raised when an undecorated class that is using Angular features
36 * has been discovered.
37 */
38 UNDECORATED_CLASS_USING_ANGULAR_FEATURES = 2007,
39 /**
40 * Raised when an component cannot resolve an external resource, such as a template or a style
41 * sheet.
42 */
43 COMPONENT_RESOURCE_NOT_FOUND = 2008,
44 /**
45 * Raised when a component uses `ShadowDom` view encapsulation, but its selector
46 * does not match the shadow DOM tag name requirements.
47 */
48 COMPONENT_INVALID_SHADOW_DOM_SELECTOR = 2009,
49 /**
50 * Raised when a component has `imports` but is not marked as `standalone: true`.
51 */
52 COMPONENT_NOT_STANDALONE = 2010,
53 /**
54 * Raised when a type in the `imports` of a component is a directive or pipe, but is not
55 * standalone.
56 */
57 COMPONENT_IMPORT_NOT_STANDALONE = 2011,
58 /**
59 * Raised when a type in the `imports` of a component is not a directive, pipe, or NgModule.
60 */
61 COMPONENT_UNKNOWN_IMPORT = 2012,
62 SYMBOL_NOT_EXPORTED = 3001,
63 /**
64 * Raised when a relationship between directives and/or pipes would cause a cyclic import to be
65 * created that cannot be handled, such as in partial compilation mode.
66 */
67 IMPORT_CYCLE_DETECTED = 3003,
68 /**
69 * Raised when the compiler is unable to generate an import statement for a reference.
70 */
71 IMPORT_GENERATION_FAILURE = 3004,
72 CONFIG_FLAT_MODULE_NO_INDEX = 4001,
73 CONFIG_STRICT_TEMPLATES_IMPLIES_FULL_TEMPLATE_TYPECHECK = 4002,
74 CONFIG_EXTENDED_DIAGNOSTICS_IMPLIES_STRICT_TEMPLATES = 4003,
75 CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL = 4004,
76 CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CHECK = 4005,
77 /**
78 * Raised when a host expression has a parse error, such as a host listener or host binding
79 * expression containing a pipe.
80 */
81 HOST_BINDING_PARSE_ERROR = 5001,
82 /**
83 * Raised when the compiler cannot parse a component's template.
84 */
85 TEMPLATE_PARSE_ERROR = 5002,
86 /**
87 * Raised when an NgModule contains an invalid reference in `declarations`.
88 */
89 NGMODULE_INVALID_DECLARATION = 6001,
90 /**
91 * Raised when an NgModule contains an invalid type in `imports`.
92 */
93 NGMODULE_INVALID_IMPORT = 6002,
94 /**
95 * Raised when an NgModule contains an invalid type in `exports`.
96 */
97 NGMODULE_INVALID_EXPORT = 6003,
98 /**
99 * Raised when an NgModule contains a type in `exports` which is neither in `declarations` nor
100 * otherwise imported.
101 */
102 NGMODULE_INVALID_REEXPORT = 6004,
103 /**
104 * Raised when a `ModuleWithProviders` with a missing
105 * generic type argument is passed into an `NgModule`.
106 */
107 NGMODULE_MODULE_WITH_PROVIDERS_MISSING_GENERIC = 6005,
108 /**
109 * Raised when an NgModule exports multiple directives/pipes of the same name and the compiler
110 * attempts to generate private re-exports within the NgModule file.
111 */
112 NGMODULE_REEXPORT_NAME_COLLISION = 6006,
113 /**
114 * Raised when a directive/pipe is part of the declarations of two or more NgModules.
115 */
116 NGMODULE_DECLARATION_NOT_UNIQUE = 6007,
117 /**
118 * Raised when a standalone directive/pipe is part of the declarations of an NgModule.
119 */
120 NGMODULE_DECLARATION_IS_STANDALONE = 6008,
121 /**
122 * Raised when a standalone component is part of the bootstrap list of an NgModule.
123 */
124 NGMODULE_BOOTSTRAP_IS_STANDALONE = 6009,
125 /**
126 * Indicates that an NgModule is declared with `id: module.id`. This is an anti-pattern that is
127 * disabled explicitly in the compiler, that was originally based on a misunderstanding of
128 * `NgModule.id`.
129 */
130 WARN_NGMODULE_ID_UNNECESSARY = 6100,
131 /**
132 * Not actually raised by the compiler, but reserved for documentation of a View Engine error when
133 * a View Engine build depends on an Ivy-compiled NgModule.
134 */
135 NGMODULE_VE_DEPENDENCY_ON_IVY_LIB = 6999,
136 /**
137 * An element name failed validation against the DOM schema.
138 */
139 SCHEMA_INVALID_ELEMENT = 8001,
140 /**
141 * An element's attribute name failed validation against the DOM schema.
142 */
143 SCHEMA_INVALID_ATTRIBUTE = 8002,
144 /**
145 * No matching directive was found for a `#ref="target"` expression.
146 */
147 MISSING_REFERENCE_TARGET = 8003,
148 /**
149 * No matching pipe was found for a
150 */
151 MISSING_PIPE = 8004,
152 /**
153 * The left-hand side of an assignment expression was a template variable. Effectively, the
154 * template looked like:
155 *
156 * ```
157 * <ng-template let-something>
158 * <button (click)="something = ...">...</button>
159 * </ng-template>
160 * ```
161 *
162 * Template variables are read-only.
163 */
164 WRITE_TO_READ_ONLY_VARIABLE = 8005,
165 /**
166 * A template variable was declared twice. For example:
167 *
168 * ```html
169 * <div *ngFor="let i of items; let i = index">
170 * </div>
171 * ```
172 */
173 DUPLICATE_VARIABLE_DECLARATION = 8006,
174 /**
175 * A template has a two way binding (two bindings created by a single syntactical element)
176 * in which the input and output are going to different places.
177 */
178 SPLIT_TWO_WAY_BINDING = 8007,
179 /**
180 * A two way binding in a template has an incorrect syntax,
181 * parentheses outside brackets. For example:
182 *
183 * ```
184 * <div ([foo])="bar" />
185 * ```
186 */
187 INVALID_BANANA_IN_BOX = 8101,
188 /**
189 * The left side of a nullish coalescing operation is not nullable.
190 *
191 * ```
192 * {{ foo ?? bar }}
193 * ```
194 * When the type of foo doesn't include `null` or `undefined`.
195 */
196 NULLISH_COALESCING_NOT_NULLABLE = 8102,
197 /**
198 * A known control flow directive (e.g. `*ngIf`) is used in a template,
199 * but the `CommonModule` is not imported.
200 */
201 MISSING_CONTROL_FLOW_DIRECTIVE = 8103,
202 /**
203 * A text attribute is not interpreted as a binding but likely intended to be.
204 *
205 * For example:
206 * ```
207 * <div
208 * attr.x="value"
209 * class.blue="true"
210 * style.margin-right.px="5">
211 * </div>
212 * ```
213 *
214 * All of the above attributes will just be static text attributes and will not be interpreted as
215 * bindings by the compiler.
216 */
217 TEXT_ATTRIBUTE_NOT_BINDING = 8104,
218 /**
219 * NgForOf is used in a template, but the user forgot to include let
220 * in their statement.
221 *
222 * For example:
223 * ```
224 * <ul><li *ngFor="item of items">{{item["name"]}};</li></ul>
225 * ```
226 */
227 MISSING_NGFOROF_LET = 8105,
228 /**
229 * Indicates that the binding suffix is not supported
230 *
231 * Style bindings support suffixes like `style.width.px`, `.em`, and `.%`.
232 * These suffixes are _not_ supported for attribute bindings.
233 *
234 * For example `[attr.width.px]="5"` becomes `width.px="5"` when bound.
235 * This is almost certainly unintentional and this error is meant to
236 * surface this mistake to the developer.
237 */
238 SUFFIX_NOT_SUPPORTED = 8106,
239 /**
240 * The left side of an optional chain operation is not nullable.
241 *
242 * ```
243 * {{ foo?.bar }}
244 * {{ foo?.['bar'] }}
245 * {{ foo?.() }}
246 * ```
247 * When the type of foo doesn't include `null` or `undefined`.
248 */
249 OPTIONAL_CHAIN_NOT_NULLABLE = 8107,
250 /**
251 * The template type-checking engine would need to generate an inline type check block for a
252 * component, but the current type-checking environment doesn't support it.
253 */
254 INLINE_TCB_REQUIRED = 8900,
255 /**
256 * The template type-checking engine would need to generate an inline type constructor for a
257 * directive or component, but the current type-checking environment doesn't support it.
258 */
259 INLINE_TYPE_CTOR_REQUIRED = 8901,
260 /**
261 * An injectable already has a `ɵprov` property.
262 */
263 INJECTABLE_DUPLICATE_PROV = 9001,
264 /**
265 * Suggest users to enable `strictTemplates` to make use of full capabilities
266 * provided by Angular language service.
267 */
268 SUGGEST_STRICT_TEMPLATES = 10001,
269 /**
270 * Indicates that a particular structural directive provides advanced type narrowing
271 * functionality, but the current template type-checking configuration does not allow its usage in
272 * type inference.
273 */
274 SUGGEST_SUBOPTIMAL_TYPE_INFERENCE = 10002
275}