fix(ivy): use any for generic context checks when !strictTemplates (#34649)

Previously, the template type-checker would always construct a generic
template context type with correct bounds, even when strictTemplates was
disabled. This meant that type-checking of expressions involving that type
was stricter than View Engine.

This commit introduces a 'strictContextGenerics' flag which behaves
similarly to other 'strictTemplates' flags, and switches the inference of
generic type parameters on the component context based on the value of this
flag.

PR Close #34649
This commit is contained in:
Alex Rickabaugh
2019-12-19 17:09:56 -08:00
committed by Andrew Kushnir
parent 2cf7d0fd05
commit e69d02c69f
9 changed files with 61 additions and 8 deletions

View File

@ -972,7 +972,8 @@ export declare class AnimationEvent {
});
it('should constrain types using type parameter bounds', () => {
env.tsconfig({fullTemplateTypeCheck: true, strictInputTypes: true});
env.tsconfig(
{fullTemplateTypeCheck: true, strictInputTypes: true, strictContextGenerics: true});
env.write('test.ts', `
import {CommonModule} from '@angular/common';
import {Component, Input, NgModule} from '@angular/core';