Merge pull request #21947 from Microsoft/fixKeyofWildcard

Fix issue with 'keyof T' and conditional types
This commit is contained in:
Anders Hejlsberg authored and GitHub committed 2018-02-15 12:44:51 -08:00
commit 0f697c376b
6 files changed
+316

No files matched your search

+1
View File
@@ -7949,6 +7949,7 @@ namespace ts {
function getIndexType(type: Type): Type {
return maybeTypeOfKind(type, TypeFlags.InstantiableNonPrimitive) ? getIndexTypeForGenericType(<InstantiableType | UnionOrIntersectionType>type) :
getObjectFlags(type) & ObjectFlags.Mapped ? getConstraintTypeFromMappedType(<MappedType>type) :
type === wildcardType ? wildcardType :
type.flags & TypeFlags.Any || getIndexInfoOfType(type, IndexKind.String) ? stringType :
getLiteralTypeFromPropertyNames(type);
}