Home / Function/ printInferredDependency() — react Function Reference

printInferredDependency() — react Function Reference

Architecture documentation for the printInferredDependency() function in ValidateExhaustiveDependencies.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  5c1b7287_7b37_cc84_107a_381efa1943e3["printInferredDependency()"]
  fe7a7397_dddc_7222_20d4_d5b1015466f1["ValidateExhaustiveDependencies.ts"]
  5c1b7287_7b37_cc84_107a_381efa1943e3 -->|defined in| fe7a7397_dddc_7222_20d4_d5b1015466f1
  6869984f_c56b_62c6_1328_06ff93395ab4["validateDependencies()"]
  6869984f_c56b_62c6_1328_06ff93395ab4 -->|calls| 5c1b7287_7b37_cc84_107a_381efa1943e3
  041ca752_10c1_3cda_1f5c_02f44a01310e["invariant()"]
  5c1b7287_7b37_cc84_107a_381efa1943e3 -->|calls| 041ca752_10c1_3cda_1f5c_02f44a01310e
  8e8b7ee8_d3c2_f98d_17e1_c5ff5fff1940["map()"]
  5c1b7287_7b37_cc84_107a_381efa1943e3 -->|calls| 8e8b7ee8_d3c2_f98d_17e1_c5ff5fff1940
  style 5c1b7287_7b37_cc84_107a_381efa1943e3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateExhaustiveDependencies.ts lines 868–884

function printInferredDependency(dep: InferredDependency): string {
  switch (dep.kind) {
    case 'Global': {
      return dep.binding.name;
    }
    case 'Local': {
      CompilerError.invariant(
        dep.identifier.name != null && dep.identifier.name.kind === 'named',
        {
          reason: 'Expected dependencies to be named variables',
          loc: dep.loc,
        },
      );
      return `${dep.identifier.name.value}${dep.path.map(p => (p.optional ? '?' : '') + '.' + p.property).join('')}`;
    }
  }
}

Domain

Subdomains

Frequently Asked Questions

What does printInferredDependency() do?
printInferredDependency() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateExhaustiveDependencies.ts.
Where is printInferredDependency() defined?
printInferredDependency() is defined in compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateExhaustiveDependencies.ts at line 868.
What does printInferredDependency() call?
printInferredDependency() calls 2 function(s): invariant, map.
What calls printInferredDependency()?
printInferredDependency() is called by 1 function(s): validateDependencies.

Analyze Your Own Codebase

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

Try Supermodel Free