Home / Function/ installTypeConfig() — react Function Reference

installTypeConfig() — react Function Reference

Architecture documentation for the installTypeConfig() function in Globals.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  b5df453b_1fe3_4bcb_9def_abba2aa3a9a4["installTypeConfig()"]
  38c44267_cdd2_9815_ebad_fa6761ba5934["Globals.ts"]
  b5df453b_1fe3_4bcb_9def_abba2aa3a9a4 -->|defined in| 38c44267_cdd2_9815_ebad_fa6761ba5934
  7a9cb2a9_3a71_c8b5_2c56_ccdd941f7d64["moduleName()"]
  7a9cb2a9_3a71_c8b5_2c56_ccdd941f7d64 -->|calls| b5df453b_1fe3_4bcb_9def_abba2aa3a9a4
  d7fde76c_4fd9_feb3_299b_798689f05bc6["assertExhaustive()"]
  b5df453b_1fe3_4bcb_9def_abba2aa3a9a4 -->|calls| d7fde76c_4fd9_feb3_299b_798689f05bc6
  a77ff0f7_0c98_02df_9507_6da9eca5fbb5["addFunction()"]
  b5df453b_1fe3_4bcb_9def_abba2aa3a9a4 -->|calls| a77ff0f7_0c98_02df_9507_6da9eca5fbb5
  d0882928_65af_dce8_5416_84ed7f492587["addHook()"]
  b5df453b_1fe3_4bcb_9def_abba2aa3a9a4 -->|calls| d0882928_65af_dce8_5416_84ed7f492587
  fdd1014d_2fa9_cdec_af9b_b2e2bada1088["addObject()"]
  b5df453b_1fe3_4bcb_9def_abba2aa3a9a4 -->|calls| fdd1014d_2fa9_cdec_af9b_b2e2bada1088
  c32c4801_8f1e_6ab5_ff15_ac8ec7df6945["isHookName()"]
  b5df453b_1fe3_4bcb_9def_abba2aa3a9a4 -->|calls| c32c4801_8f1e_6ab5_ff15_ac8ec7df6945
  style b5df453b_1fe3_4bcb_9def_abba2aa3a9a4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/HIR/Globals.ts lines 967–1077

export function installTypeConfig(
  globals: GlobalRegistry,
  shapes: ShapeRegistry,
  typeConfig: TypeConfig,
  moduleName: string,
  loc: SourceLocation,
): Global {
  switch (typeConfig.kind) {
    case 'type': {
      switch (typeConfig.name) {
        case 'Array': {
          return {kind: 'Object', shapeId: BuiltInArrayId};
        }
        case 'MixedReadonly': {
          return {kind: 'Object', shapeId: BuiltInMixedReadonlyId};
        }
        case 'Primitive': {
          return {kind: 'Primitive'};
        }
        case 'Ref': {
          return {kind: 'Object', shapeId: BuiltInUseRefId};
        }
        case 'Any': {
          return {kind: 'Poly'};
        }
        default: {
          assertExhaustive(
            typeConfig.name,
            `Unexpected type '${(typeConfig as any).name}'`,
          );
        }
      }
    }
    case 'function': {
      return addFunction(shapes, [], {
        positionalParams: typeConfig.positionalParams,
        restParam: typeConfig.restParam,
        calleeEffect: typeConfig.calleeEffect,
        returnType: installTypeConfig(
          globals,
          shapes,
          typeConfig.returnType,
          moduleName,
          loc,
        ),
        returnValueKind: typeConfig.returnValueKind,
        noAlias: typeConfig.noAlias === true,
        mutableOnlyIfOperandsAreMutable:
          typeConfig.mutableOnlyIfOperandsAreMutable === true,
        aliasing: typeConfig.aliasing,
        knownIncompatible: typeConfig.knownIncompatible ?? null,
      });
    }
    case 'hook': {
      return addHook(shapes, {
        hookKind: 'Custom',
        positionalParams: typeConfig.positionalParams ?? [],
        restParam: typeConfig.restParam ?? Effect.Freeze,
        calleeEffect: Effect.Read,
        returnType: installTypeConfig(
          globals,
          shapes,
          typeConfig.returnType,
          moduleName,
          loc,
        ),
        returnValueKind: typeConfig.returnValueKind ?? ValueKind.Frozen,
        noAlias: typeConfig.noAlias === true,
        aliasing: typeConfig.aliasing,
        knownIncompatible: typeConfig.knownIncompatible ?? null,
      });
    }
    case 'object': {
      return addObject(
        shapes,
        null,
        Object.entries(typeConfig.properties ?? {}).map(([key, value]) => {
          const type = installTypeConfig(
            globals,
            shapes,
            value,

Subdomains

Called By

Frequently Asked Questions

What does installTypeConfig() do?
installTypeConfig() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/Globals.ts.
Where is installTypeConfig() defined?
installTypeConfig() is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/Globals.ts at line 967.
What does installTypeConfig() call?
installTypeConfig() calls 5 function(s): addFunction, addHook, addObject, assertExhaustive, isHookName.
What calls installTypeConfig()?
installTypeConfig() is called by 1 function(s): moduleName.

Analyze Your Own Codebase

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

Try Supermodel Free