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