Home / Function/ isValidPropsAnnotation() — react Function Reference

isValidPropsAnnotation() — react Function Reference

Architecture documentation for the isValidPropsAnnotation() function in Program.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  4653f7ad_06cf_fc52_32b4_0419d5483cef["isValidPropsAnnotation()"]
  9aa4477d_960b_1ea1_b6d9_36076aaa70bd["Program.ts"]
  4653f7ad_06cf_fc52_32b4_0419d5483cef -->|defined in| 9aa4477d_960b_1ea1_b6d9_36076aaa70bd
  6020b327_3c33_4f61_7c23_7f5e35e56457["isValidComponentParams()"]
  6020b327_3c33_4f61_7c23_7f5e35e56457 -->|calls| 4653f7ad_06cf_fc52_32b4_0419d5483cef
  d7fde76c_4fd9_feb3_299b_798689f05bc6["assertExhaustive()"]
  4653f7ad_06cf_fc52_32b4_0419d5483cef -->|calls| d7fde76c_4fd9_feb3_299b_798689f05bc6
  style 4653f7ad_06cf_fc52_32b4_0419d5483cef fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Program.ts lines 1106–1149

function isValidPropsAnnotation(
  annot: t.TypeAnnotation | t.TSTypeAnnotation | t.Noop | null | undefined,
): boolean {
  if (annot == null) {
    return true;
  } else if (annot.type === 'TSTypeAnnotation') {
    switch (annot.typeAnnotation.type) {
      case 'TSArrayType':
      case 'TSBigIntKeyword':
      case 'TSBooleanKeyword':
      case 'TSConstructorType':
      case 'TSFunctionType':
      case 'TSLiteralType':
      case 'TSNeverKeyword':
      case 'TSNumberKeyword':
      case 'TSStringKeyword':
      case 'TSSymbolKeyword':
      case 'TSTupleType':
        return false;
    }
    return true;
  } else if (annot.type === 'TypeAnnotation') {
    switch (annot.typeAnnotation.type) {
      case 'ArrayTypeAnnotation':
      case 'BooleanLiteralTypeAnnotation':
      case 'BooleanTypeAnnotation':
      case 'EmptyTypeAnnotation':
      case 'FunctionTypeAnnotation':
      case 'NumberLiteralTypeAnnotation':
      case 'NumberTypeAnnotation':
      case 'StringLiteralTypeAnnotation':
      case 'StringTypeAnnotation':
      case 'SymbolTypeAnnotation':
      case 'ThisTypeAnnotation':
      case 'TupleTypeAnnotation':
        return false;
    }
    return true;
  } else if (annot.type === 'Noop') {
    return true;
  } else {
    assertExhaustive(annot, `Unexpected annotation node \`${annot}\``);
  }
}

Domain

Subdomains

Frequently Asked Questions

What does isValidPropsAnnotation() do?
isValidPropsAnnotation() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Program.ts.
Where is isValidPropsAnnotation() defined?
isValidPropsAnnotation() is defined in compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Program.ts at line 1106.
What does isValidPropsAnnotation() call?
isValidPropsAnnotation() calls 1 function(s): assertExhaustive.
What calls isValidPropsAnnotation()?
isValidPropsAnnotation() is called by 1 function(s): isValidComponentParams.

Analyze Your Own Codebase

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

Try Supermodel Free