Support properties of mapped types in assertion control flow analysis (#40482)

* Support properties of mapped types in assertion control flow analysis

* Add regression test

* Accept new baselines
This commit is contained in:
Anders Hejlsberg
2020-09-21 07:07:29 -10:00
committed by GitHub
parent 8cd4793a9c
commit ce3dbef5f7
6 changed files with 119 additions and 0 deletions

View File

@@ -21103,6 +21103,12 @@ namespace ts {
return getTypeOfSymbol(symbol);
}
if (symbol.flags & (SymbolFlags.Variable | SymbolFlags.Property)) {
if (getCheckFlags(symbol) & CheckFlags.Mapped) {
const origin = (<MappedSymbol>symbol).syntheticOrigin;
if (origin && getExplicitTypeOfSymbol(origin)) {
return getTypeOfSymbol(symbol);
}
}
const declaration = symbol.valueDeclaration;
if (declaration) {
if (isDeclarationWithExplicitTypeAnnotation(declaration)) {