diff --git a/lib/mock-component/mock-component.ts b/lib/mock-component/mock-component.ts index 31ab54e5a5..f65f4a54a0 100644 --- a/lib/mock-component/mock-component.ts +++ b/lib/mock-component/mock-component.ts @@ -28,7 +28,7 @@ class ComponentMockBase extends MockControlValueAccessor implements AfterContent } public ngAfterContentInit(): void { - const config: any = this.__ngMocksConfig?.config; + const config = (this.__ngMocksConfig as any).config; if (!(this as any).__rendered && config && config.render) { for (const block of Object.keys(config.render)) { const { $implicit, variables } = @@ -45,11 +45,11 @@ class ComponentMockBase extends MockControlValueAccessor implements AfterContent } private __ngMocksInstall(changeDetector: ChangeDetectorRef): void { - const refs: any = this.__ngMocksConfig?.viewChildRefs; + const refs = (this.__ngMocksConfig as any).viewChildRefs; // Providing method to hide any @ContentChild based on its selector. (this as any).__hide = (contentChildSelector: string) => { - const key = refs?.get(contentChildSelector); + const key = refs.get(contentChildSelector); if (key) { (this as any)[`mockRender_${contentChildSelector}`] = false; changeDetector.detectChanges(); @@ -58,7 +58,7 @@ class ComponentMockBase extends MockControlValueAccessor implements AfterContent // Providing a method to render any @ContentChild based on its selector. (this as any).__render = (contentChildSelector: string, $implicit?: any, variables?: Record) => { - const key = refs?.get(contentChildSelector); + const key = refs.get(contentChildSelector); let templateRef: TemplateRef; let viewContainer: ViewContainerRef; if (key) { diff --git a/lib/mock-directive/mock-directive.ts b/lib/mock-directive/mock-directive.ts index 6ec0daec98..3c81a0eb6f 100644 --- a/lib/mock-directive/mock-directive.ts +++ b/lib/mock-directive/mock-directive.ts @@ -24,7 +24,7 @@ class DirectiveMockBase extends MockControlValueAccessor implements OnInit { } public ngOnInit(): void { - const config: any = this.__ngMocksConfig?.config; + const config = (this.__ngMocksConfig as any).config; if (config?.render) { const { $implicit, variables } = config.render !== true diff --git a/lib/mock-helper/mock-helper.attributes.ts b/lib/mock-helper/mock-helper.attributes.ts index be4a3fa211..0e0d33a293 100644 --- a/lib/mock-helper/mock-helper.attributes.ts +++ b/lib/mock-helper/mock-helper.attributes.ts @@ -22,7 +22,7 @@ export default (label: string, attr: 'inputs' | 'outputs', ...args: any[]) => { } /* istanbul ignore if */ - for (const attrDef of meta[attr] || []) { + for (const attrDef of meta[attr] || /* istanbul ignore next */ []) { const [prop, alias = ''] = attrDef.split(':', 2).map(v => v.trim()); if (!alias && prop !== sel) { continue; diff --git a/lib/mock/clone-providers.ts b/lib/mock/clone-providers.ts index f115bfd740..32dd31cf63 100644 --- a/lib/mock/clone-providers.ts +++ b/lib/mock/clone-providers.ts @@ -12,7 +12,7 @@ export default (mockType: AnyType, providers?: any[]): { providers: Provide let setNgValueAccessor: boolean | undefined; const resolutions = new Map(); - for (const providerDef of flatten(providers || [])) { + for (const providerDef of flatten(providers || /* istanbul ignore next */ [])) { const provide = providerDef && typeof providerDef === 'object' && providerDef.provide ? providerDef.provide : providerDef; if (provide === NG_VALIDATORS) {