feat(compiler): enabled strict checking of parameters to an @Injectable
(#19412)
Added the compiler options `strictInjectionParameters` that defaults to `false`. If enabled the compiler will report errors for parameters of an `@Injectable` that cannot be determined instead of generating a warning. This is planned to be switched to default to `true` for Angular 6.0.
This commit is contained in:

committed by
Victor Berchet

parent
a75040d0a1
commit
dfb8d21ef4
@ -21,17 +21,18 @@ export class CompilerConfig {
|
||||
public jitDevMode: boolean;
|
||||
public missingTranslation: MissingTranslationStrategy|null;
|
||||
public preserveWhitespaces: boolean;
|
||||
public strictInjectionParameters: boolean;
|
||||
|
||||
constructor(
|
||||
{defaultEncapsulation = ViewEncapsulation.Emulated, useJit = true, jitDevMode = false,
|
||||
missingTranslation, enableLegacyTemplate, preserveWhitespaces}: {
|
||||
missingTranslation, enableLegacyTemplate, preserveWhitespaces, strictInjectionParameters}: {
|
||||
defaultEncapsulation?: ViewEncapsulation,
|
||||
useJit?: boolean,
|
||||
jitDevMode?: boolean,
|
||||
missingTranslation?: MissingTranslationStrategy,
|
||||
enableLegacyTemplate?: boolean,
|
||||
preserveWhitespaces?: boolean,
|
||||
fullTemplateTypeCheck?: boolean
|
||||
strictInjectionParameters?: boolean,
|
||||
} = {}) {
|
||||
this.defaultEncapsulation = defaultEncapsulation;
|
||||
this.useJit = !!useJit;
|
||||
@ -39,6 +40,7 @@ export class CompilerConfig {
|
||||
this.missingTranslation = missingTranslation || null;
|
||||
this.enableLegacyTemplate = enableLegacyTemplate === true;
|
||||
this.preserveWhitespaces = preserveWhitespacesDefault(noUndefined(preserveWhitespaces));
|
||||
this.strictInjectionParameters = strictInjectionParameters === true;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user