Home / Function/ getConstructionExpressionType() — react Function Reference

getConstructionExpressionType() — react Function Reference

Architecture documentation for the getConstructionExpressionType() function in ExhaustiveDeps.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  7a2259f8_1f4c_06e7_2604_f580d5a246f0["getConstructionExpressionType()"]
  ea02b01a_dd46_4b35_fe00_775aec496668["ExhaustiveDeps.ts"]
  7a2259f8_1f4c_06e7_2604_f580d5a246f0 -->|defined in| ea02b01a_dd46_4b35_fe00_775aec496668
  a8ca46d1_1e1d_7275_227b_3492441252b4["scanForConstructions()"]
  a8ca46d1_1e1d_7275_227b_3492441252b4 -->|calls| 7a2259f8_1f4c_06e7_2604_f580d5a246f0
  style 7a2259f8_1f4c_06e7_2604_f580d5a246f0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/eslint-plugin-react-hooks/src/rules/ExhaustiveDeps.ts lines 1714–1763

function getConstructionExpressionType(node: Node): string | null {
  switch (node.type) {
    case 'ObjectExpression':
      return 'object';
    case 'ArrayExpression':
      return 'array';
    case 'ArrowFunctionExpression':
    case 'FunctionExpression':
      return 'function';
    case 'ClassExpression':
      return 'class';
    case 'ConditionalExpression':
      if (
        getConstructionExpressionType(node.consequent) != null ||
        getConstructionExpressionType(node.alternate) != null
      ) {
        return 'conditional';
      }
      return null;
    case 'LogicalExpression':
      if (
        getConstructionExpressionType(node.left) != null ||
        getConstructionExpressionType(node.right) != null
      ) {
        return 'logical expression';
      }
      return null;
    case 'JSXFragment':
      return 'JSX fragment';
    case 'JSXElement':
      return 'JSX element';
    case 'AssignmentExpression':
      if (getConstructionExpressionType(node.right) != null) {
        return 'assignment expression';
      }
      return null;
    case 'NewExpression':
      return 'object construction';
    case 'Literal':
      if (node.value instanceof RegExp) {
        return 'regular expression';
      }
      return null;
    case 'TypeCastExpression':
    case 'AsExpression':
    case 'TSAsExpression':
      return getConstructionExpressionType(node.expression);
  }
  return null;
}

Domain

Subdomains

Frequently Asked Questions

What does getConstructionExpressionType() do?
getConstructionExpressionType() is a function in the react codebase, defined in packages/eslint-plugin-react-hooks/src/rules/ExhaustiveDeps.ts.
Where is getConstructionExpressionType() defined?
getConstructionExpressionType() is defined in packages/eslint-plugin-react-hooks/src/rules/ExhaustiveDeps.ts at line 1714.
What calls getConstructionExpressionType()?
getConstructionExpressionType() is called by 1 function(s): scanForConstructions.

Analyze Your Own Codebase

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

Try Supermodel Free