Exclude method symbols when relating tuple types

This commit is contained in:
Anders Hejlsberg 2019-08-28 07:52:42 -04:00
parent 8f3a91724e
commit 842c588f3e

View file

@ -14123,9 +14123,11 @@ namespace ts {
// We only call this for union target types when we're attempting to do excess property checking - in those cases, we want to get _all possible props_
// from the target union, across all members
const properties = target.flags & TypeFlags.Union ? getPossiblePropertiesOfUnionType(target as UnionType) : getPropertiesOfType(target);
const numericNamesOnly = isTupleType(source) && isTupleType(target);
for (const targetProp of excludeProperties(properties, excludedProperties)) {
if (!(targetProp.flags & SymbolFlags.Prototype)) {
const sourceProp = getPropertyOfType(source, targetProp.escapedName);
const name = targetProp.escapedName;
if (!(targetProp.flags & SymbolFlags.Prototype) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length")) {
const sourceProp = getPropertyOfType(source, name);
if (sourceProp && sourceProp !== targetProp) {
const related = propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSymbol, reportErrors, isIntersectionConstituent);
if (!related) {