Home / Function/ hasNode() — react Function Reference

hasNode() — react Function Reference

Architecture documentation for the hasNode() function in utils.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  d5e0302e_0924_3d1c_bfcb_bc2180bf984c["hasNode()"]
  eb9d33f9_42c1_205c_93e6_8e1365a31839["utils.ts"]
  d5e0302e_0924_3d1c_bfcb_bc2180bf984c -->|defined in| eb9d33f9_42c1_205c_93e6_8e1365a31839
  f214c28b_2f6d_b5a3_71e1_9a69d9b50455["lower()"]
  f214c28b_2f6d_b5a3_71e1_9a69d9b50455 -->|calls| d5e0302e_0924_3d1c_bfcb_bc2180bf984c
  c01b12bd_811d_9f90_f641_fac8e518dbb7["lowerStatement()"]
  c01b12bd_811d_9f90_f641_fac8e518dbb7 -->|calls| d5e0302e_0924_3d1c_bfcb_bc2180bf984c
  style d5e0302e_0924_3d1c_bfcb_bc2180bf984c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/Utils/utils.ts lines 170–179

export function hasNode<T>(
  input: NodePath<T | null | undefined>,
): input is NodePath<NonNullable<T>> {
  /*
   * Internal babel is on an older version that does not have hasNode (v7.17)
   * See https://github.com/babel/babel/pull/13940/files for impl
   * https://github.com/babel/babel/blob/5ebab544af2f1c6fc6abdaae6f4e5426975c9a16/packages/babel-traverse/src/path/index.ts#L128-L130
   */
  return input.node != null;
}

Domain

Subdomains

Frequently Asked Questions

What does hasNode() do?
hasNode() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Utils/utils.ts.
Where is hasNode() defined?
hasNode() is defined in compiler/packages/babel-plugin-react-compiler/src/Utils/utils.ts at line 170.
What calls hasNode()?
hasNode() is called by 2 function(s): lower, lowerStatement.

Analyze Your Own Codebase

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

Try Supermodel Free