UNPKG

16.8 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.dev/license
7 */
8/**
9 * @publicApi
10 */
11export declare enum ErrorCode {
12 DECORATOR_ARG_NOT_LITERAL = 1001,
13 DECORATOR_ARITY_WRONG = 1002,
14 DECORATOR_NOT_CALLED = 1003,
15 DECORATOR_UNEXPECTED = 1005,
16 /**
17 * This error code indicates that there are incompatible decorators on a type or a class field.
18 */
19 DECORATOR_COLLISION = 1006,
20 VALUE_HAS_WRONG_TYPE = 1010,
21 VALUE_NOT_LITERAL = 1011,
22 /**
23 * Raised when an initializer API is annotated with an unexpected decorator.
24 *
25 * e.g. `@Input` is also applied on the class member using `input`.
26 */
27 INITIALIZER_API_WITH_DISALLOWED_DECORATOR = 1050,
28 /**
29 * Raised when an initializer API feature (like signal inputs) are also
30 * declared in the class decorator metadata.
31 *
32 * e.g. a signal input is also declared in the `@Directive` `inputs` array.
33 */
34 INITIALIZER_API_DECORATOR_METADATA_COLLISION = 1051,
35 /**
36 * Raised whenever an initializer API does not support the `.required`
37 * function, but is still detected unexpectedly.
38 */
39 INITIALIZER_API_NO_REQUIRED_FUNCTION = 1052,
40 /**
41 * Raised whenever an initializer API is used on a class member
42 * and the given access modifiers (e.g. `private`) are not allowed.
43 */
44 INITIALIZER_API_DISALLOWED_MEMBER_VISIBILITY = 1053,
45 /**
46 * An Angular feature, like inputs, outputs or queries is incorrectly
47 * declared on a static member.
48 */
49 INCORRECTLY_DECLARED_ON_STATIC_MEMBER = 1100,
50 COMPONENT_MISSING_TEMPLATE = 2001,
51 PIPE_MISSING_NAME = 2002,
52 PARAM_MISSING_TOKEN = 2003,
53 DIRECTIVE_MISSING_SELECTOR = 2004,
54 /** Raised when an undecorated class is passed in as a provider to a module or a directive. */
55 UNDECORATED_PROVIDER = 2005,
56 /**
57 * Raised when a Directive inherits its constructor from a base class without an Angular
58 * decorator.
59 */
60 DIRECTIVE_INHERITS_UNDECORATED_CTOR = 2006,
61 /**
62 * Raised when an undecorated class that is using Angular features
63 * has been discovered.
64 */
65 UNDECORATED_CLASS_USING_ANGULAR_FEATURES = 2007,
66 /**
67 * Raised when an component cannot resolve an external resource, such as a template or a style
68 * sheet.
69 */
70 COMPONENT_RESOURCE_NOT_FOUND = 2008,
71 /**
72 * Raised when a component uses `ShadowDom` view encapsulation, but its selector
73 * does not match the shadow DOM tag name requirements.
74 */
75 COMPONENT_INVALID_SHADOW_DOM_SELECTOR = 2009,
76 /**
77 * Raised when a component has `imports` but is not marked as `standalone: true`.
78 */
79 COMPONENT_NOT_STANDALONE = 2010,
80 /**
81 * Raised when a type in the `imports` of a component is a directive or pipe, but is not
82 * standalone.
83 */
84 COMPONENT_IMPORT_NOT_STANDALONE = 2011,
85 /**
86 * Raised when a type in the `imports` of a component is not a directive, pipe, or NgModule.
87 */
88 COMPONENT_UNKNOWN_IMPORT = 2012,
89 /**
90 * Raised when the compiler wasn't able to resolve the metadata of a host directive.
91 */
92 HOST_DIRECTIVE_INVALID = 2013,
93 /**
94 * Raised when a host directive isn't standalone.
95 */
96 HOST_DIRECTIVE_NOT_STANDALONE = 2014,
97 /**
98 * Raised when a host directive is a component.
99 */
100 HOST_DIRECTIVE_COMPONENT = 2015,
101 /**
102 * Raised when a type with Angular decorator inherits its constructor from a base class
103 * which has a constructor that is incompatible with Angular DI.
104 */
105 INJECTABLE_INHERITS_INVALID_CONSTRUCTOR = 2016,
106 /** Raised when a host tries to alias a host directive binding that does not exist. */
107 HOST_DIRECTIVE_UNDEFINED_BINDING = 2017,
108 /**
109 * Raised when a host tries to alias a host directive
110 * binding to a pre-existing binding's public name.
111 */
112 HOST_DIRECTIVE_CONFLICTING_ALIAS = 2018,
113 /**
114 * Raised when a host directive definition doesn't expose a
115 * required binding from the host directive.
116 */
117 HOST_DIRECTIVE_MISSING_REQUIRED_BINDING = 2019,
118 /**
119 * Raised when a component specifies both a `transform` function on an input
120 * and has a corresponding `ngAcceptInputType_` member for the same input.
121 */
122 CONFLICTING_INPUT_TRANSFORM = 2020,
123 /** Raised when a component has both `styleUrls` and `styleUrl`. */
124 COMPONENT_INVALID_STYLE_URLS = 2021,
125 /**
126 * Raised when a type in the `deferredImports` of a component is not a component, directive or
127 * pipe.
128 */
129 COMPONENT_UNKNOWN_DEFERRED_IMPORT = 2022,
130 /**
131 * Raised when a `standalone: false` component is declared but `strictStandalone` is set.
132 */
133 NON_STANDALONE_NOT_ALLOWED = 2023,
134 SYMBOL_NOT_EXPORTED = 3001,
135 /**
136 * Raised when a relationship between directives and/or pipes would cause a cyclic import to be
137 * created that cannot be handled, such as in partial compilation mode.
138 */
139 IMPORT_CYCLE_DETECTED = 3003,
140 /**
141 * Raised when the compiler is unable to generate an import statement for a reference.
142 */
143 IMPORT_GENERATION_FAILURE = 3004,
144 CONFIG_FLAT_MODULE_NO_INDEX = 4001,
145 CONFIG_STRICT_TEMPLATES_IMPLIES_FULL_TEMPLATE_TYPECHECK = 4002,
146 CONFIG_EXTENDED_DIAGNOSTICS_IMPLIES_STRICT_TEMPLATES = 4003,
147 CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL = 4004,
148 CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CHECK = 4005,
149 /**
150 * Raised when a host expression has a parse error, such as a host listener or host binding
151 * expression containing a pipe.
152 */
153 HOST_BINDING_PARSE_ERROR = 5001,
154 /**
155 * Raised when the compiler cannot parse a component's template.
156 */
157 TEMPLATE_PARSE_ERROR = 5002,
158 /**
159 * Raised when an NgModule contains an invalid reference in `declarations`.
160 */
161 NGMODULE_INVALID_DECLARATION = 6001,
162 /**
163 * Raised when an NgModule contains an invalid type in `imports`.
164 */
165 NGMODULE_INVALID_IMPORT = 6002,
166 /**
167 * Raised when an NgModule contains an invalid type in `exports`.
168 */
169 NGMODULE_INVALID_EXPORT = 6003,
170 /**
171 * Raised when an NgModule contains a type in `exports` which is neither in `declarations` nor
172 * otherwise imported.
173 */
174 NGMODULE_INVALID_REEXPORT = 6004,
175 /**
176 * Raised when a `ModuleWithProviders` with a missing
177 * generic type argument is passed into an `NgModule`.
178 */
179 NGMODULE_MODULE_WITH_PROVIDERS_MISSING_GENERIC = 6005,
180 /**
181 * Raised when an NgModule exports multiple directives/pipes of the same name and the compiler
182 * attempts to generate private re-exports within the NgModule file.
183 */
184 NGMODULE_REEXPORT_NAME_COLLISION = 6006,
185 /**
186 * Raised when a directive/pipe is part of the declarations of two or more NgModules.
187 */
188 NGMODULE_DECLARATION_NOT_UNIQUE = 6007,
189 /**
190 * Raised when a standalone directive/pipe is part of the declarations of an NgModule.
191 */
192 NGMODULE_DECLARATION_IS_STANDALONE = 6008,
193 /**
194 * Raised when a standalone component is part of the bootstrap list of an NgModule.
195 */
196 NGMODULE_BOOTSTRAP_IS_STANDALONE = 6009,
197 /**
198 * Indicates that an NgModule is declared with `id: module.id`. This is an anti-pattern that is
199 * disabled explicitly in the compiler, that was originally based on a misunderstanding of
200 * `NgModule.id`.
201 */
202 WARN_NGMODULE_ID_UNNECESSARY = 6100,
203 /**
204 * 6999 was previously assigned to NGMODULE_VE_DEPENDENCY_ON_IVY_LIB
205 * To prevent any confusion, let's not reassign it.
206 */
207 /**
208 * An element name failed validation against the DOM schema.
209 */
210 SCHEMA_INVALID_ELEMENT = 8001,
211 /**
212 * An element's attribute name failed validation against the DOM schema.
213 */
214 SCHEMA_INVALID_ATTRIBUTE = 8002,
215 /**
216 * No matching directive was found for a `#ref="target"` expression.
217 */
218 MISSING_REFERENCE_TARGET = 8003,
219 /**
220 * No matching pipe was found for a
221 */
222 MISSING_PIPE = 8004,
223 /**
224 * The left-hand side of an assignment expression was a template variable. Effectively, the
225 * template looked like:
226 *
227 * ```html
228 * <ng-template let-something>
229 * <button (click)="something = ...">...</button>
230 * </ng-template>
231 * ```
232 *
233 * Template variables are read-only.
234 */
235 WRITE_TO_READ_ONLY_VARIABLE = 8005,
236 /**
237 * A template variable was declared twice. For example:
238 *
239 * ```html
240 * <div *ngFor="let i of items; let i = index">
241 * </div>
242 * ```
243 */
244 DUPLICATE_VARIABLE_DECLARATION = 8006,
245 /**
246 * A template has a two way binding (two bindings created by a single syntactical element)
247 * in which the input and output are going to different places.
248 */
249 SPLIT_TWO_WAY_BINDING = 8007,
250 /**
251 * A directive usage isn't binding to one or more required inputs.
252 */
253 MISSING_REQUIRED_INPUTS = 8008,
254 /**
255 * The tracking expression of a `for` loop block is accessing a variable that is unavailable,
256 * for example:
257 *
258 * ```angular-html
259 * <ng-template let-ref>
260 * @for (item of items; track ref) {}
261 * </ng-template>
262 * ```
263 */
264 ILLEGAL_FOR_LOOP_TRACK_ACCESS = 8009,
265 /**
266 * The trigger of a `defer` block cannot access its trigger element,
267 * either because it doesn't exist or it's in a different view.
268 *
269 * ```angular-html
270 * @defer (on interaction(trigger)) {...}
271 *
272 * <ng-template>
273 * <button #trigger></button>
274 * </ng-template>
275 * ```
276 */
277 INACCESSIBLE_DEFERRED_TRIGGER_ELEMENT = 8010,
278 /**
279 * A control flow node is projected at the root of a component and is preventing its direct
280 * descendants from being projected, because it has more than one root node.
281 *
282 * ```angular-html
283 * <comp>
284 * @if (expr) {
285 * <div projectsIntoSlot></div>
286 * Text preventing the div from being projected
287 * }
288 * </comp>
289 * ```
290 */
291 CONTROL_FLOW_PREVENTING_CONTENT_PROJECTION = 8011,
292 /**
293 * A pipe imported via `@Component.deferredImports` is
294 * used outside of a `@defer` block in a template.
295 */
296 DEFERRED_PIPE_USED_EAGERLY = 8012,
297 /**
298 * A directive/component imported via `@Component.deferredImports` is
299 * used outside of a `@defer` block in a template.
300 */
301 DEFERRED_DIRECTIVE_USED_EAGERLY = 8013,
302 /**
303 * A directive/component/pipe imported via `@Component.deferredImports` is
304 * also included into the `@Component.imports` list.
305 */
306 DEFERRED_DEPENDENCY_IMPORTED_EAGERLY = 8014,
307 /** An expression is trying to write to an `@let` declaration. */
308 ILLEGAL_LET_WRITE = 8015,
309 /** An expression is trying to read an `@let` before it has been defined. */
310 LET_USED_BEFORE_DEFINITION = 8016,
311 /** A `@let` declaration conflicts with another symbol in the same scope. */
312 CONFLICTING_LET_DECLARATION = 8017,
313 /**
314 * A two way binding in a template has an incorrect syntax,
315 * parentheses outside brackets. For example:
316 *
317 * ```html
318 * <div ([foo])="bar" />
319 * ```
320 */
321 INVALID_BANANA_IN_BOX = 8101,
322 /**
323 * The left side of a nullish coalescing operation is not nullable.
324 *
325 * ```html
326 * {{ foo ?? bar }}
327 * ```
328 * When the type of foo doesn't include `null` or `undefined`.
329 */
330 NULLISH_COALESCING_NOT_NULLABLE = 8102,
331 /**
332 * A known control flow directive (e.g. `*ngIf`) is used in a template,
333 * but the `CommonModule` is not imported.
334 */
335 MISSING_CONTROL_FLOW_DIRECTIVE = 8103,
336 /**
337 * A text attribute is not interpreted as a binding but likely intended to be.
338 *
339 * For example:
340 * ```html
341 * <div
342 * attr.x="value"
343 * class.blue="true"
344 * style.margin-right.px="5">
345 * </div>
346 * ```
347 *
348 * All of the above attributes will just be static text attributes and will not be interpreted as
349 * bindings by the compiler.
350 */
351 TEXT_ATTRIBUTE_NOT_BINDING = 8104,
352 /**
353 * NgForOf is used in a template, but the user forgot to include let
354 * in their statement.
355 *
356 * For example:
357 * ```html
358 * <ul><li *ngFor="item of items">{{item["name"]}};</li></ul>
359 * ```
360 */
361 MISSING_NGFOROF_LET = 8105,
362 /**
363 * Indicates that the binding suffix is not supported
364 *
365 * Style bindings support suffixes like `style.width.px`, `.em`, and `.%`.
366 * These suffixes are _not_ supported for attribute bindings.
367 *
368 * For example `[attr.width.px]="5"` becomes `width.px="5"` when bound.
369 * This is almost certainly unintentional and this error is meant to
370 * surface this mistake to the developer.
371 */
372 SUFFIX_NOT_SUPPORTED = 8106,
373 /**
374 * The left side of an optional chain operation is not nullable.
375 *
376 * ```html
377 * {{ foo?.bar }}
378 * {{ foo?.['bar'] }}
379 * {{ foo?.() }}
380 * ```
381 * When the type of foo doesn't include `null` or `undefined`.
382 */
383 OPTIONAL_CHAIN_NOT_NULLABLE = 8107,
384 /**
385 * `ngSkipHydration` should not be a binding (it should be a static attribute).
386 *
387 * For example:
388 * ```html
389 * <my-cmp [ngSkipHydration]="someTruthyVar" />
390 * ```
391 *
392 * `ngSkipHydration` cannot be a binding and can not have values other than "true" or an empty
393 * value
394 */
395 SKIP_HYDRATION_NOT_STATIC = 8108,
396 /**
397 * Signal functions should be invoked when interpolated in templates.
398 *
399 * For example:
400 * ```html
401 * {{ mySignal() }}
402 * ```
403 */
404 INTERPOLATED_SIGNAL_NOT_INVOKED = 8109,
405 /**
406 * Initializer-based APIs can only be invoked from inside of an initializer.
407 *
408 * ```ts
409 * // Allowed
410 * myInput = input();
411 *
412 * // Not allowed
413 * function myInput() {
414 * return input();
415 * }
416 * ```
417 */
418 UNSUPPORTED_INITIALIZER_API_USAGE = 8110,
419 /**
420 * A function in an event binding is not called.
421 *
422 * For example:
423 * ```html
424 * <button (click)="myFunc"></button>
425 * ```
426 *
427 * This will not call `myFunc` when the button is clicked. Instead, it should be
428 * `<button (click)="myFunc()"></button>`.
429 */
430 UNINVOKED_FUNCTION_IN_EVENT_BINDING = 8111,
431 /**
432 * A `@let` declaration in a template isn't used.
433 *
434 * For example:
435 * ```angular-html
436 * @let used = 1; <!-- Not an error -->
437 * @let notUsed = 2; <!-- Error -->
438 *
439 * {{used}}
440 * ```
441 */
442 UNUSED_LET_DECLARATION = 8112,
443 /**
444 * A symbol referenced in `@Component.imports` isn't being used within the template.
445 */
446 UNUSED_STANDALONE_IMPORTS = 8113,
447 /**
448 * The template type-checking engine would need to generate an inline type check block for a
449 * component, but the current type-checking environment doesn't support it.
450 */
451 INLINE_TCB_REQUIRED = 8900,
452 /**
453 * The template type-checking engine would need to generate an inline type constructor for a
454 * directive or component, but the current type-checking environment doesn't support it.
455 */
456 INLINE_TYPE_CTOR_REQUIRED = 8901,
457 /**
458 * An injectable already has a `ɵprov` property.
459 */
460 INJECTABLE_DUPLICATE_PROV = 9001,
461 /**
462 * Suggest users to enable `strictTemplates` to make use of full capabilities
463 * provided by Angular language service.
464 */
465 SUGGEST_STRICT_TEMPLATES = 10001,
466 /**
467 * Indicates that a particular structural directive provides advanced type narrowing
468 * functionality, but the current template type-checking configuration does not allow its usage in
469 * type inference.
470 */
471 SUGGEST_SUBOPTIMAL_TYPE_INFERENCE = 10002,
472 /**
473 * In local compilation mode a const is required to be resolved statically but cannot be so since
474 * it is imported from a file outside of the compilation unit. This usually happens with const
475 * being used as Angular decorators parameters such as `@Component.template`,
476 * `@HostListener.eventName`, etc.
477 */
478 LOCAL_COMPILATION_UNRESOLVED_CONST = 11001,
479 /**
480 * In local compilation mode a certain expression or syntax is not supported. This is usually
481 * because the expression/syntax is not very common and so we did not add support for it yet. This
482 * can be changed in the future and support for more expressions could be added if need be.
483 * Meanwhile, this error is thrown to indicate a current unavailability.
484 */
485 LOCAL_COMPILATION_UNSUPPORTED_EXPRESSION = 11003
486}