Home / File/ InferTypes.ts — react Source File

InferTypes.ts — react Source File

Architecture documentation for InferTypes.ts, a typescript file in the react codebase. 19 imports, 0 dependents.

File typescript MIRInfrastructure HIR 19 imports 10 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  35147ed6_ce97_e85f_570c_faf2d25f42f4["InferTypes.ts"]
  e96f281e_f381_272d_2359_3e6a091c9a1d["CompilerError.ts"]
  35147ed6_ce97_e85f_570c_faf2d25f42f4 --> e96f281e_f381_272d_2359_3e6a091c9a1d
  e51fd0d2_bb38_cc97_7763_efe37f300a47["CompilerError"]
  35147ed6_ce97_e85f_570c_faf2d25f42f4 --> e51fd0d2_bb38_cc97_7763_efe37f300a47
  0423f759_97e0_9101_4634_ed555abc5ca9["index.ts"]
  35147ed6_ce97_e85f_570c_faf2d25f42f4 --> 0423f759_97e0_9101_4634_ed555abc5ca9
  e04c04d6_37a7_1dc3_7fae_7d07660d0af9["BuildHIR.ts"]
  35147ed6_ce97_e85f_570c_faf2d25f42f4 --> e04c04d6_37a7_1dc3_7fae_7d07660d0af9
  5a2f5c1a_7817_5684_6d8a_1817aafa108c["lowerType"]
  35147ed6_ce97_e85f_570c_faf2d25f42f4 --> 5a2f5c1a_7817_5684_6d8a_1817aafa108c
  18a78965_f593_105b_e5e8_07001321c2ec["HIR.ts"]
  35147ed6_ce97_e85f_570c_faf2d25f42f4 --> 18a78965_f593_105b_e5e8_07001321c2ec
  9241c5c1_a9a7_17bc_e41c_e967225008dd["HIRFunction"]
  35147ed6_ce97_e85f_570c_faf2d25f42f4 --> 9241c5c1_a9a7_17bc_e41c_e967225008dd
  bd003dbd_e691_524b_0cf4_50e080ffea94["Identifier"]
  35147ed6_ce97_e85f_570c_faf2d25f42f4 --> bd003dbd_e691_524b_0cf4_50e080ffea94
  e3a6ca26_1f1a_c7f8_fbf3_804737192775["IdentifierId"]
  35147ed6_ce97_e85f_570c_faf2d25f42f4 --> e3a6ca26_1f1a_c7f8_fbf3_804737192775
  02d16d8e_0a17_fa6f_eeef_ee0c7d25bd36["Instruction"]
  35147ed6_ce97_e85f_570c_faf2d25f42f4 --> 02d16d8e_0a17_fa6f_eeef_ee0c7d25bd36
  03aa18e2_bd2c_e9cb_5973_bae3ec02373c["InstructionKind"]
  35147ed6_ce97_e85f_570c_faf2d25f42f4 --> 03aa18e2_bd2c_e9cb_5973_bae3ec02373c
  3532df9c_cf42_5889_99aa_db6c6d3e1708["makePropertyLiteral"]
  35147ed6_ce97_e85f_570c_faf2d25f42f4 --> 3532df9c_cf42_5889_99aa_db6c6d3e1708
  58f81300_7c82_5086_3e10_e46b5f3ab04d["ObjectShape.ts"]
  35147ed6_ce97_e85f_570c_faf2d25f42f4 --> 58f81300_7c82_5086_3e10_e46b5f3ab04d
  2f3caf55_cc64_415c_55dd_9771ba7dc210["visitors.ts"]
  35147ed6_ce97_e85f_570c_faf2d25f42f4 --> 2f3caf55_cc64_415c_55dd_9771ba7dc210
  style 35147ed6_ce97_e85f_570c_faf2d25f42f4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

import * as t from '@babel/types';
import {CompilerError} from '../CompilerError';
import {Environment} from '../HIR';
import {lowerType} from '../HIR/BuildHIR';
import {
  GeneratedSource,
  HIRFunction,
  Identifier,
  IdentifierId,
  Instruction,
  InstructionKind,
  makePropertyLiteral,
  makeType,
  PropType,
  Type,
  typeEquals,
  TypeId,
  TypeVar,
} from '../HIR/HIR';
import {
  BuiltInArrayId,
  BuiltInEventHandlerId,
  BuiltInFunctionId,
  BuiltInJsxId,
  BuiltInMixedReadonlyId,
  BuiltInObjectId,
  BuiltInPropsId,
  BuiltInRefValueId,
  BuiltInSetStateId,
  BuiltInUseRefId,
} from '../HIR/ObjectShape';
import {eachInstructionLValue, eachInstructionOperand} from '../HIR/visitors';
import {assertExhaustive} from '../Utils/utils';

function isPrimitiveBinaryOp(op: t.BinaryExpression['operator']): boolean {
  switch (op) {
    case '+':
    case '-':
    case '/':
    case '%':
    case '*':
    case '**':
    case '&':
    case '|':
    case '>>':
    case '<<':
    case '^':
    case '>':
    case '<':
    case '>=':
    case '<=':
    case '|>':
      return true;
// ... (821 more lines)

Subdomains

Classes

Frequently Asked Questions

What does InferTypes.ts do?
InferTypes.ts is a source file in the react codebase, written in typescript. It belongs to the MIRInfrastructure domain, HIR subdomain.
What functions are defined in InferTypes.ts?
InferTypes.ts defines 10 function(s): apply, equation, generate, generateInstructionTypes, getName, inferTypes, isPrimitiveBinaryOp, isRefLikeName, setName, tryUnionTypes.
What does InferTypes.ts depend on?
InferTypes.ts imports 19 module(s): BuildHIR.ts, CompilerError, CompilerError.ts, HIR.ts, HIRFunction, Identifier, IdentifierId, Instruction, and 11 more.
Where is InferTypes.ts in the architecture?
InferTypes.ts is located at compiler/packages/babel-plugin-react-compiler/src/TypeInference/InferTypes.ts (domain: MIRInfrastructure, subdomain: HIR, directory: compiler/packages/babel-plugin-react-compiler/src/TypeInference).

Analyze Your Own Codebase

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

Try Supermodel Free