fix(compiler): only warn for @Injectable
classes with invalid args.
In v2.x, users had to annotate classes that they intended to use as tokens with `@Injectable`. This is no longer required in v4.x for tokens, and we now require the constructor parameters of classes annotated with `@Injectable` to be statically analyzable by ngc. This commit reduces the error into a warning if the constructor parameters do not meet this condition. DEPRECATION: - Classes annotated with `@Injectable` but whose constructor’s parameter types are not statically analyzable by ngc will produce a warning. Closes #15003
This commit is contained in:

committed by
Chuck Jazdzewski

parent
50ab06e29d
commit
5c34066058
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
import {AotSummaryResolver, CompileDirectiveMetadata, CompileMetadataResolver, CompilerConfig, DEFAULT_INTERPOLATION_CONFIG, DirectiveNormalizer, DirectiveResolver, DomElementSchemaRegistry, HtmlParser, InterpolationConfig, NgAnalyzedModules, NgModuleResolver, ParseTreeResult, Parser, PipeResolver, ResourceLoader, StaticReflector, StaticSymbol, StaticSymbolCache, StaticSymbolResolver, SummaryResolver, UrlResolver, analyzeNgModules, componentModuleUrl, createOfflineCompileUrlResolver, extractProgramSymbols} from '@angular/compiler';
|
||||
import {Type, ViewEncapsulation} from '@angular/core';
|
||||
import {Type, ViewEncapsulation, ɵConsole as Console} from '@angular/core';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as ts from 'typescript';
|
||||
@ -115,8 +115,8 @@ export class TypeScriptServiceHost implements LanguageServiceHost {
|
||||
|
||||
result = this._resolver = new CompileMetadataResolver(
|
||||
config, moduleResolver, directiveResolver, pipeResolver, new SummaryResolver(),
|
||||
elementSchemaRegistry, directiveNormalizer, this._staticSymbolCache, this.reflector,
|
||||
(error, type) => this.collectError(error, type && type.filePath));
|
||||
elementSchemaRegistry, directiveNormalizer, new Console(), this._staticSymbolCache,
|
||||
this.reflector, (error, type) => this.collectError(error, type && type.filePath));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user