@@ -9427,7 +9427,7 @@ namespace ts {
94279427 function hasCommonProperties(source: Type, target: Type) {
94289428 const isComparingJsxAttributes = !!(source.flags & TypeFlags.JsxAttributes);
94299429 for (const prop of getPropertiesOfType(source)) {
9430- if (isKnownProperty(target, prop.name, isComparingJsxAttributes, /*skipGlobalObject*/ true )) {
9430+ if (isKnownProperty(target, prop.name, isComparingJsxAttributes)) {
94319431 return true;
94329432 }
94339433 }
@@ -14214,19 +14214,23 @@ namespace ts {
1421414214
1421514215 /**
1421614216 * Check if a property with the given name is known anywhere in the given type. In an object type, a property
14217- * is considered known if the object type is empty and the check is for assignability, if the object type has
14218- * index signatures, or if the property is actually declared in the object type. In a union or intersection
14219- * type, a property is considered known if it is known in any constituent type.
14217+ * is considered known if
14218+ * 1. the object type is empty and the check is for assignability, or
14219+ * 2. if the object type has index signatures, or
14220+ * 3. if the property is actually declared in the object type
14221+ * (this means that 'toString', for example, is not usually a known property).
14222+ * 4. In a union or intersection type,
14223+ * a property is considered known if it is known in any constituent type.
1422014224 * @param targetType a type to search a given name in
1422114225 * @param name a property name to search
1422214226 * @param isComparingJsxAttributes a boolean flag indicating whether we are searching in JsxAttributesType
1422314227 */
14224- function isKnownProperty(targetType: Type, name: string, isComparingJsxAttributes: boolean, skipGlobalObject?: boolean ): boolean {
14228+ function isKnownProperty(targetType: Type, name: string, isComparingJsxAttributes: boolean): boolean {
1422514229 if (targetType.flags & TypeFlags.Object) {
1422614230 const resolved = resolveStructuredTypeMembers(<ObjectType>targetType);
1422714231 if (resolved.stringIndexInfo ||
1422814232 resolved.numberIndexInfo && isNumericLiteralName(name) ||
14229- (skipGlobalObject ? getPropertyOfObjectType(targetType, name) : getPropertyOfType(targetType, name) ) ||
14233+ getPropertyOfObjectType(targetType, name) ||
1423014234 isComparingJsxAttributes && !isUnhyphenatedJsxName(name)) {
1423114235 // For JSXAttributes, if the attribute has a hyphenated name, consider that the attribute to be known.
1423214236 return true;
0 commit comments