mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
[typer] Reuse PolyType objects
This commit is contained in:
@@ -317,12 +317,15 @@ class Unifier {
|
||||
objectType.kind === "Object" &&
|
||||
objectType.properties.has(name[0])
|
||||
) {
|
||||
const newType: Type = {
|
||||
kind: "Poly",
|
||||
};
|
||||
let type = objectType.properties.get(name[0])!;
|
||||
if (type.kind === "Poly") {
|
||||
return type;
|
||||
}
|
||||
|
||||
objectType.properties.set(name[0], newType);
|
||||
return newType;
|
||||
type = { kind: "Poly" };
|
||||
|
||||
objectType.properties.set(name[0], type);
|
||||
return type;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user