angular/goldens/public-api/compiler-cli/error_code.api.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

126 lines
4.5 KiB
Markdown
Raw Normal View History

## API Report File for "angular-srcs"
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
// @public (undocumented)
export enum ErrorCode {
COMPONENT_IMPORT_NOT_STANDALONE = 2011,
COMPONENT_INVALID_SHADOW_DOM_SELECTOR = 2009,
COMPONENT_INVALID_STYLE_URLS = 2021,
// (undocumented)
COMPONENT_MISSING_TEMPLATE = 2001,
COMPONENT_NOT_STANDALONE = 2010,
COMPONENT_RESOURCE_NOT_FOUND = 2008,
COMPONENT_UNKNOWN_DEFERRED_IMPORT = 2022,
COMPONENT_UNKNOWN_IMPORT = 2012,
// (undocumented)
CONFIG_EXTENDED_DIAGNOSTICS_IMPLIES_STRICT_TEMPLATES = 4003,
// (undocumented)
CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL = 4004,
// (undocumented)
CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CHECK = 4005,
// (undocumented)
CONFIG_FLAT_MODULE_NO_INDEX = 4001,
// (undocumented)
CONFIG_STRICT_TEMPLATES_IMPLIES_FULL_TEMPLATE_TYPECHECK = 4002,
refactor(compiler): introduce compiler infrastructure for input transforms (#50225) Adds the necessary compiler changes to support input transform functions. The compiler output has changed in the following ways: ### Directive handler The directive handler now extracts a reference to the input transform function and it resolves the type of its first parameter. It also asserts that the type can be referenced in the compiled output and that it doesn't clash with any pre-existing `ngAcceptInputType_` members. ### .d.ts In the generated declaration files the compiler now inserts an `ngAcceptInputType_` member for each input with a `transform` function. The member's type corresponds to the type of the first parameter of the function, e.g. ```typescript // foo.directive.ts @Directive() export class Foo { @Input({transform: (incomingValue: string) => parseInt(incomingValue)}) value: number; } // foo.directive.d.ts export class Foo { value: number; static ngAcceptInputType_value: string; } ``` ### Type check block If an input has `transform` function, the TCB will use the type of its first parameter for the setter type. This uses the same infrastructure as the `ngAcceptInputType_` members. ### Directive declaration The generated runtime directive declaration call now includes the `transform` function in the `inputs` map, if the input is being transformed. The function will be picked up by the runtime in the next commit to do the actual transformation. ```typescript // foo.directive.ts @Directive() export class Foo { @Input({transform: (incomingValue: string) => parseInt(incomingValue)}) value: number; } // foo.directive.js export class Foo { ɵdir = ɵɵdefineDirective({ inputs: { value: ['value', 'value', incomingValue => parseInt(incomingValue)] } }); } ``` PR Close #50225
2023-05-10 07:37:57 +00:00
CONFLICTING_INPUT_TRANSFORM = 2020,
CONFLICTING_LET_DECLARATION = 8017,
CONTROL_FLOW_PREVENTING_CONTENT_PROJECTION = 8011,
// (undocumented)
DECORATOR_ARG_NOT_LITERAL = 1001,
// (undocumented)
DECORATOR_ARITY_WRONG = 1002,
DECORATOR_COLLISION = 1006,
// (undocumented)
DECORATOR_NOT_CALLED = 1003,
// (undocumented)
DECORATOR_UNEXPECTED = 1005,
DEFERRED_DEPENDENCY_IMPORTED_EAGERLY = 8014,
DEFERRED_DIRECTIVE_USED_EAGERLY = 8013,
DEFERRED_PIPE_USED_EAGERLY = 8012,
DIRECTIVE_INHERITS_UNDECORATED_CTOR = 2006,
// (undocumented)
DIRECTIVE_MISSING_SELECTOR = 2004,
// (undocumented)
DUPLICATE_DECORATED_PROPERTIES = 1012,
DUPLICATE_VARIABLE_DECLARATION = 8006,
HOST_BINDING_PARSE_ERROR = 5001,
HOST_DIRECTIVE_COMPONENT = 2015,
HOST_DIRECTIVE_CONFLICTING_ALIAS = 2018,
HOST_DIRECTIVE_INVALID = 2013,
HOST_DIRECTIVE_MISSING_REQUIRED_BINDING = 2019,
HOST_DIRECTIVE_NOT_STANDALONE = 2014,
HOST_DIRECTIVE_UNDEFINED_BINDING = 2017,
ILLEGAL_FOR_LOOP_TRACK_ACCESS = 8009,
ILLEGAL_LET_WRITE = 8015,
IMPORT_CYCLE_DETECTED = 3003,
IMPORT_GENERATION_FAILURE = 3004,
INACCESSIBLE_DEFERRED_TRIGGER_ELEMENT = 8010,
INCORRECTLY_DECLARED_ON_STATIC_MEMBER = 1100,
INITIALIZER_API_DECORATOR_METADATA_COLLISION = 1051,
INITIALIZER_API_DISALLOWED_MEMBER_VISIBILITY = 1053,
INITIALIZER_API_NO_REQUIRED_FUNCTION = 1052,
INITIALIZER_API_WITH_DISALLOWED_DECORATOR = 1050,
INJECTABLE_DUPLICATE_PROV = 9001,
fix(compiler-cli): exclude abstract classes from `strictInjectionParameters` requirement (#44615) In AOT compilations, the `strictInjectionParameters` compiler option can be enabled to report errors when an `@Injectable` annotated class has a constructor with parameters that do not provide an injection token, e.g. only a primitive type or interface. Since Ivy it's become required that any class with Angular behavior (e.g. the `ngOnDestroy` lifecycle hook) is decorated using an Angular decorator, which meant that `@Injectable()` may need to have been added to abstract base classes. Doing so would then report an error if `strictInjectionParameters` is enabled, if the abstract class has an incompatible constructor for DI purposes. This may be fine though, as a subclass may call the constructor explicitly without relying on Angular's DI mechanism. Therefore, this commit excludes abstract classes from the `strictInjectionParameters` check. This avoids an error from being reported at compile time. If the constructor ends up being used by Angular's DI system at runtime, then the factory function of the abstract class will throw an error by means of the `ɵɵinvalidFactory` instruction. In addition to the runtime error, this commit also analyzes the inheritance chain of an injectable without a constructor to verify that their inherited constructor is valid. BREAKING CHANGE: Invalid constructors for DI may now report compilation errors When a class inherits its constructor from a base class, the compiler may now report an error when that constructor cannot be used for DI purposes. This may either be because the base class is missing an Angular decorator such as `@Injectable()` or `@Directive()`, or because the constructor contains parameters which do not have an associated token (such as primitive types like `string`). These situations used to behave unexpectedly at runtime, where the class may be constructed without any of its constructor parameters, so this is now reported as an error during compilation. Any new errors that may be reported because of this change can be resolved either by decorating the base class from which the constructor is inherited, or by adding an explicit constructor to the class for which the error is reported. Closes #37914 PR Close #44615
2022-01-04 18:03:30 +00:00
INJECTABLE_INHERITS_INVALID_CONSTRUCTOR = 2016,
INLINE_TCB_REQUIRED = 8900,
INLINE_TYPE_CTOR_REQUIRED = 8901,
INTERPOLATED_SIGNAL_NOT_INVOKED = 8109,
INVALID_BANANA_IN_BOX = 8101,
LET_USED_BEFORE_DEFINITION = 8016,
LOCAL_COMPILATION_UNRESOLVED_CONST = 11001,
LOCAL_COMPILATION_UNSUPPORTED_EXPRESSION = 11003,
MISSING_CONTROL_FLOW_DIRECTIVE = 8103,
MISSING_NGFOROF_LET = 8105,
MISSING_PIPE = 8004,
MISSING_REFERENCE_TARGET = 8003,
MISSING_REQUIRED_INPUTS = 8008,
NGMODULE_BOOTSTRAP_IS_STANDALONE = 6009,
NGMODULE_DECLARATION_IS_STANDALONE = 6008,
NGMODULE_DECLARATION_NOT_UNIQUE = 6007,
NGMODULE_INVALID_DECLARATION = 6001,
NGMODULE_INVALID_EXPORT = 6003,
NGMODULE_INVALID_IMPORT = 6002,
NGMODULE_INVALID_REEXPORT = 6004,
NGMODULE_MODULE_WITH_PROVIDERS_MISSING_GENERIC = 6005,
NGMODULE_REEXPORT_NAME_COLLISION = 6006,
NON_STANDALONE_NOT_ALLOWED = 2023,
NULLISH_COALESCING_NOT_NULLABLE = 8102,
OPTIONAL_CHAIN_NOT_NULLABLE = 8107,
// (undocumented)
PARAM_MISSING_TOKEN = 2003,
// (undocumented)
PIPE_MISSING_NAME = 2002,
SCHEMA_INVALID_ATTRIBUTE = 8002,
SCHEMA_INVALID_ELEMENT = 8001,
SKIP_HYDRATION_NOT_STATIC = 8108,
SPLIT_TWO_WAY_BINDING = 8007,
SUFFIX_NOT_SUPPORTED = 8106,
fix(language-service): show suggestion when type inference is suboptimal (#41072) The Ivy Language Service uses the compiler's template type-checking engine, which honors the configuration in the user's tsconfig.json. We recommend that users upgrade to `strictTemplates` mode in their projects to take advantage of the best possible type inference, and thus to have the best experience in Language Service. If a project is not using `strictTemplates`, then the compiler will not leverage certain type inference options it has. One case where this is very noticeable is the inference of let- variables for structural directives that provide a template context guard (such as NgFor). Without `strictTemplates`, these guards will not be applied and such variables will be inferred as 'any', degrading the user experience within Language Service. This is working as designed, since the Language Service _should_ reflect types exactly as the compiler sees them. However, the View Engine Language Service used its own type system that _would_ infer these types even when the compiler did not. As a result, it's confusing to some users why the Ivy Language Service has "worse" type inference. To address this confusion, this commit implements a suggestion diagnostic which is shown in the Language Service for variables which could have been narrowed via a context guard, but the type checking configuration didn't allow it. This should make the reason why variables receive the 'any' type as well as the action needed to improve the typings much more obvious, improving the Language Service experience. Fixes angular/vscode-ng-language-service#1155 Closes #41042 PR Close #41072
2021-03-03 23:06:21 +00:00
SUGGEST_STRICT_TEMPLATES = 10001,
SUGGEST_SUBOPTIMAL_TYPE_INFERENCE = 10002,
// (undocumented)
SYMBOL_NOT_EXPORTED = 3001,
TEMPLATE_PARSE_ERROR = 5002,
TEXT_ATTRIBUTE_NOT_BINDING = 8104,
UNDECORATED_CLASS_USING_ANGULAR_FEATURES = 2007,
UNDECORATED_PROVIDER = 2005,
UNINVOKED_FUNCTION_IN_EVENT_BINDING = 8111,
UNINVOKED_TRACK_FUNCTION = 8115,
UNPARENTHESIZED_NULLISH_COALESCING = 8114,
UNSUPPORTED_INITIALIZER_API_USAGE = 8110,
UNUSED_LET_DECLARATION = 8112,
UNUSED_STANDALONE_IMPORTS = 8113,
// (undocumented)
VALUE_HAS_WRONG_TYPE = 1010,
// (undocumented)
VALUE_NOT_LITERAL = 1011,
WARN_NGMODULE_ID_UNNECESSARY = 6100,
WRITE_TO_READ_ONLY_VARIABLE = 8005
}
// (No @packageDocumentation comment for this package)
```