mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
[types] Check propType when checking if two types are equal
This commit is contained in:
@@ -143,6 +143,7 @@ export function typeEquals(tA: Type, tB: Type): boolean {
|
||||
primitiveTypeEquals(tA, tB) ||
|
||||
polyTypeEquals(tA, tB) ||
|
||||
phiTypeEquals(tA, tB) ||
|
||||
propTypeEquals(tA, tB) ||
|
||||
objectMethodTypeEquals(tA, tB)
|
||||
);
|
||||
}
|
||||
@@ -162,6 +163,18 @@ function objectMethodTypeEquals(tA: Type, tB: Type): boolean {
|
||||
return typeKindCheck(tA, tB, "ObjectMethod");
|
||||
}
|
||||
|
||||
function propTypeEquals(tA: Type, tB: Type): boolean {
|
||||
if (tA.kind === "Property" && tB.kind === "Property") {
|
||||
if (!typeEquals(tA.object, tB.object)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return tA.propertyName === tB.propertyName;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function primitiveTypeEquals(tA: Type, tB: Type): boolean {
|
||||
return typeKindCheck(tA, tB, "Primitive");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user