Home / Function/ addShape() — react Function Reference

addShape() — react Function Reference

Architecture documentation for the addShape() function in ObjectShape.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  54994d7a_c3e1_1a38_0769_4562dd8f15b4["addShape()"]
  58f81300_7c82_5086_3e10_e46b5f3ab04d["ObjectShape.ts"]
  54994d7a_c3e1_1a38_0769_4562dd8f15b4 -->|defined in| 58f81300_7c82_5086_3e10_e46b5f3ab04d
  a77ff0f7_0c98_02df_9507_6da9eca5fbb5["addFunction()"]
  a77ff0f7_0c98_02df_9507_6da9eca5fbb5 -->|calls| 54994d7a_c3e1_1a38_0769_4562dd8f15b4
  d0882928_65af_dce8_5416_84ed7f492587["addHook()"]
  d0882928_65af_dce8_5416_84ed7f492587 -->|calls| 54994d7a_c3e1_1a38_0769_4562dd8f15b4
  fdd1014d_2fa9_cdec_af9b_b2e2bada1088["addObject()"]
  fdd1014d_2fa9_cdec_af9b_b2e2bada1088 -->|calls| 54994d7a_c3e1_1a38_0769_4562dd8f15b4
  041ca752_10c1_3cda_1f5c_02f44a01310e["invariant()"]
  54994d7a_c3e1_1a38_0769_4562dd8f15b4 -->|calls| 041ca752_10c1_3cda_1f5c_02f44a01310e
  style 54994d7a_c3e1_1a38_0769_4562dd8f15b4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/HIR/ObjectShape.ts lines 254–271

function addShape(
  registry: ShapeRegistry,
  id: string,
  properties: Iterable<[string, BuiltInType | PolyType]>,
  functionType: FunctionSignature | null,
): ObjectShape {
  const shape: ObjectShape = {
    properties: new Map(properties),
    functionType,
  };

  CompilerError.invariant(!registry.has(id), {
    reason: `[ObjectShape] Could not add shape to registry: name ${id} already exists.`,
    loc: GeneratedSource,
  });
  registry.set(id, shape);
  return shape;
}

Subdomains

Calls

Frequently Asked Questions

What does addShape() do?
addShape() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/ObjectShape.ts.
Where is addShape() defined?
addShape() is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/ObjectShape.ts at line 254.
What does addShape() call?
addShape() calls 1 function(s): invariant.
What calls addShape()?
addShape() is called by 3 function(s): addFunction, addHook, addObject.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free