feat(ivy): add backwards compatibility config to template type-checking (#29698)
View Engine's implementation of naive template type-checking is less advanced than the current Ivy implementation. As a result, Ivy catches lots of typing bugs which VE does not. As a result, it's necessary to tone down the Ivy template type-checker in the default case. This commit introduces a mechanism for doing that, by passing a config to the template type-checking engine. Through this configuration, particular checks can be loosened or disabled entirely. Testing strategy: TCB tests included. PR Close #29698
This commit is contained in:

committed by
Ben Lesh

parent
cd1277cfb7
commit
182e2c7449
@ -31,7 +31,7 @@ import {FactoryGenerator, FactoryInfo, GeneratedShimsHostWrapper, ShimGenerator,
|
||||
import {ivySwitchTransform} from './switch';
|
||||
import {IvyCompilation, declarationTransformFactory, ivyTransformFactory} from './transform';
|
||||
import {aliasTransformFactory} from './transform/src/alias';
|
||||
import {TypeCheckContext, TypeCheckProgramHost} from './typecheck';
|
||||
import {TypeCheckContext, TypeCheckProgramHost, TypeCheckingConfig} from './typecheck';
|
||||
import {normalizeSeparators} from './util/src/path';
|
||||
import {getRootDirs, isDtsPath} from './util/src/typescript';
|
||||
|
||||
@ -191,7 +191,12 @@ export class NgtscProgram implements api.Program {
|
||||
const compilation = this.ensureAnalyzed();
|
||||
const diagnostics = [...compilation.diagnostics];
|
||||
if (!!this.options.fullTemplateTypeCheck) {
|
||||
const ctx = new TypeCheckContext(this.refEmitter !);
|
||||
const config: TypeCheckingConfig = {
|
||||
applyTemplateContextGuards: true,
|
||||
checkTemplateBodies: true,
|
||||
checkTypeOfBindings: true,
|
||||
};
|
||||
const ctx = new TypeCheckContext(config, this.refEmitter !);
|
||||
compilation.typeCheck(ctx);
|
||||
diagnostics.push(...this.compileTypeCheckProgram(ctx));
|
||||
}
|
||||
|
Reference in New Issue
Block a user