Home / Function/ lowerType() — react Function Reference

lowerType() — react Function Reference

Architecture documentation for the lowerType() function in BuildHIR.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  5a2f5c1a_7817_5684_6d8a_1817aafa108c["lowerType()"]
  e04c04d6_37a7_1dc3_7fae_7d07660d0af9["BuildHIR.ts"]
  5a2f5c1a_7817_5684_6d8a_1817aafa108c -->|defined in| e04c04d6_37a7_1dc3_7fae_7d07660d0af9
  ace1177a_10b2_b870_31fd_da4aa845554c["lowerExpression()"]
  ace1177a_10b2_b870_31fd_da4aa845554c -->|calls| 5a2f5c1a_7817_5684_6d8a_1817aafa108c
  b282c6e8_cb4e_aa17_9bb5_f36ea62991f4["generateInstructionTypes()"]
  b282c6e8_cb4e_aa17_9bb5_f36ea62991f4 -->|calls| 5a2f5c1a_7817_5684_6d8a_1817aafa108c
  style 5a2f5c1a_7817_5684_6d8a_1817aafa108c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/HIR/BuildHIR.ts lines 4345–4386

export function lowerType(node: t.FlowType | t.TSType): Type {
  switch (node.type) {
    case 'GenericTypeAnnotation': {
      const id = node.id;
      if (id.type === 'Identifier' && id.name === 'Array') {
        return {kind: 'Object', shapeId: BuiltInArrayId};
      }
      return makeType();
    }
    case 'TSTypeReference': {
      const typeName = node.typeName;
      if (typeName.type === 'Identifier' && typeName.name === 'Array') {
        return {kind: 'Object', shapeId: BuiltInArrayId};
      }
      return makeType();
    }
    case 'ArrayTypeAnnotation':
    case 'TSArrayType': {
      return {kind: 'Object', shapeId: BuiltInArrayId};
    }
    case 'BooleanLiteralTypeAnnotation':
    case 'BooleanTypeAnnotation':
    case 'NullLiteralTypeAnnotation':
    case 'NumberLiteralTypeAnnotation':
    case 'NumberTypeAnnotation':
    case 'StringLiteralTypeAnnotation':
    case 'StringTypeAnnotation':
    case 'TSBooleanKeyword':
    case 'TSNullKeyword':
    case 'TSNumberKeyword':
    case 'TSStringKeyword':
    case 'TSSymbolKeyword':
    case 'TSUndefinedKeyword':
    case 'TSVoidKeyword':
    case 'VoidTypeAnnotation': {
      return {kind: 'Primitive'};
    }
    default: {
      return makeType();
    }
  }
}

Subdomains

Frequently Asked Questions

What does lowerType() do?
lowerType() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/BuildHIR.ts.
Where is lowerType() defined?
lowerType() is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/BuildHIR.ts at line 4345.
What calls lowerType()?
lowerType() is called by 2 function(s): generateInstructionTypes, lowerExpression.

Analyze Your Own Codebase

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

Try Supermodel Free