Elt access assignment uses declared, not narrowed type (#27574)

I forgot to do this in #26424.

Fixes #27557
Fixes #27412
This commit is contained in:
Nathan Shively-Sanders
2018-10-05 11:30:10 -07:00
committed by GitHub
parent e1d346ea53
commit c080324974
8 changed files with 108 additions and 7 deletions

View File

@@ -9305,7 +9305,9 @@ namespace ts {
}
}
const propType = getTypeOfSymbol(prop);
return accessExpression ? getFlowTypeOfReference(accessExpression, propType) : propType;
return accessExpression && getAssignmentTargetKind(accessExpression) !== AssignmentKind.Definite ?
getFlowTypeOfReference(accessExpression, propType) :
propType;
}
if (isTupleType(objectType)) {
const restType = getRestTypeOfTupleType(objectType);