{ [P in unknown]: XXX } should resolve to { [x: string]: XXX }

This commit is contained in:
Anders Hejlsberg 2018-05-27 10:25:13 -07:00
parent f63b61c3f6
commit 79e7700c6b

View file

@ -6431,7 +6431,7 @@ namespace ts {
for (const prop of getPropertiesOfType(modifiersType)) {
addMemberForKeyType(getLiteralTypeFromPropertyName(prop, include), /*_index*/ undefined, prop);
}
if (modifiersType.flags & TypeFlags.Any || getIndexInfoOfType(modifiersType, IndexKind.String)) {
if (modifiersType.flags & TypeFlags.AnyOrUnknown || getIndexInfoOfType(modifiersType, IndexKind.String)) {
addMemberForKeyType(stringType);
}
if (!keyofStringsOnly && getIndexInfoOfType(modifiersType, IndexKind.Number)) {