@@ -9427,7 +9427,7 @@ namespace ts {
9427
9427
function hasCommonProperties(source: Type, target: Type) {
9428
9428
const isComparingJsxAttributes = !!(source.flags & TypeFlags.JsxAttributes);
9429
9429
for (const prop of getPropertiesOfType(source)) {
9430
- if (isKnownProperty(target, prop.name, isComparingJsxAttributes, /*skipGlobalObject*/ true )) {
9430
+ if (isKnownProperty(target, prop.name, isComparingJsxAttributes)) {
9431
9431
return true;
9432
9432
}
9433
9433
}
@@ -14214,19 +14214,23 @@ namespace ts {
14214
14214
14215
14215
/**
14216
14216
* 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.
14220
14224
* @param targetType a type to search a given name in
14221
14225
* @param name a property name to search
14222
14226
* @param isComparingJsxAttributes a boolean flag indicating whether we are searching in JsxAttributesType
14223
14227
*/
14224
- function isKnownProperty(targetType: Type, name: string, isComparingJsxAttributes: boolean, skipGlobalObject?: boolean ): boolean {
14228
+ function isKnownProperty(targetType: Type, name: string, isComparingJsxAttributes: boolean): boolean {
14225
14229
if (targetType.flags & TypeFlags.Object) {
14226
14230
const resolved = resolveStructuredTypeMembers(<ObjectType>targetType);
14227
14231
if (resolved.stringIndexInfo ||
14228
14232
resolved.numberIndexInfo && isNumericLiteralName(name) ||
14229
- (skipGlobalObject ? getPropertyOfObjectType(targetType, name) : getPropertyOfType(targetType, name) ) ||
14233
+ getPropertyOfObjectType(targetType, name) ||
14230
14234
isComparingJsxAttributes && !isUnhyphenatedJsxName(name)) {
14231
14235
// For JSXAttributes, if the attribute has a hyphenated name, consider that the attribute to be known.
14232
14236
return true;
0 commit comments