diff --git a/compiler/packages/babel-plugin-react-forget/src/HIR/Types.ts b/compiler/packages/babel-plugin-react-forget/src/HIR/Types.ts index 0aa61913bd..ea0c6c0909 100644 --- a/compiler/packages/babel-plugin-react-forget/src/HIR/Types.ts +++ b/compiler/packages/babel-plugin-react-forget/src/HIR/Types.ts @@ -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"); }