Merge pull request #23966 from Microsoft/fixIndexedAccessAnyConstraint

Fix indexed access with 'any' constraint
This commit is contained in:
Anders Hejlsberg authored and GitHub committed 2018-05-08 12:21:00 -07:00
commit 40e0ab72d2
5 files changed
+68 -1

No files matched your search

+1 -1
View File
@@ -10755,7 +10755,7 @@ namespace ts {
}
}
const constraint = getConstraintForRelation(<TypeParameter>source);
if (!constraint || constraint.flags & TypeFlags.Any) {
if (!constraint || (source.flags & TypeFlags.TypeParameter && constraint.flags & TypeFlags.Any)) {
// A type variable with no constraint is not related to the non-primitive object type.
if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~TypeFlags.NonPrimitive))) {
errorInfo = saveErrorInfo;