Home / Function/ init() — react Function Reference

init() — react Function Reference

Architecture documentation for the init() function in Types.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  e3d1f312_c52c_8d71_91e3_cec13c53ceb5["init()"]
  62703e39_4962_1fce_0d63_004c5aacd635["FlowTypeEnv"]
  e3d1f312_c52c_8d71_91e3_cec13c53ceb5 -->|defined in| 62703e39_4962_1fce_0d63_004c5aacd635
  bec8431d_08f7_cef1_8a71_8be17fc7a31a["constructor()"]
  bec8431d_08f7_cef1_8a71_8be17fc7a31a -->|calls| e3d1f312_c52c_8d71_91e3_cec13c53ceb5
  58b4e5ec_badc_7135_9399_4df950f48acd["buildTypeEnvironment()"]
  e3d1f312_c52c_8d71_91e3_cec13c53ceb5 -->|calls| 58b4e5ec_badc_7135_9399_4df950f48acd
  25b31b43_6836_a603_053e_6e3ab2e0e8ee["convertFlowType()"]
  e3d1f312_c52c_8d71_91e3_cec13c53ceb5 -->|calls| 25b31b43_6836_a603_053e_6e3ab2e0e8ee
  style e3d1f312_c52c_8d71_91e3_cec13c53ceb5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/Flood/Types.ts lines 705–727

  init(env: Environment, source: string): void {
    // TODO: use flow-js only for web environments (e.g. playground)
    CompilerError.invariant(env.config.flowTypeProvider != null, {
      reason: 'Expected flowDumpTypes to be defined in environment config',
      loc: GeneratedSource,
    });
    let stdout: any;
    if (source === lastFlowSource) {
      stdout = lastFlowResult;
    } else {
      lastFlowSource = source;
      lastFlowResult = env.config.flowTypeProvider(source);
      stdout = lastFlowResult;
    }
    const flowTypes = buildTypeEnvironment(stdout);
    const resolvedFlowTypes = new Map<string, ResolvedType>();
    for (const [loc, type] of flowTypes) {
      if (typeof loc === 'symbol') continue;
      resolvedFlowTypes.set(loc, convertFlowType(JSON.parse(type), loc));
    }
    // =console.log(resolvedFlowTypes);
    this.#flowTypes = resolvedFlowTypes;
  }

Domain

Subdomains

Called By

Frequently Asked Questions

What does init() do?
init() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Flood/Types.ts.
Where is init() defined?
init() is defined in compiler/packages/babel-plugin-react-compiler/src/Flood/Types.ts at line 705.
What does init() call?
init() calls 2 function(s): buildTypeEnvironment, convertFlowType.
What calls init()?
init() is called by 1 function(s): constructor.

Analyze Your Own Codebase

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

Try Supermodel Free