Home / File/ Types.ts — react Source File

Types.ts — react Source File

Architecture documentation for Types.ts, a typescript file in the react codebase. 4 imports, 3 dependents.

File typescript MIRInfrastructure TypeInference 4 imports 3 dependents 13 functions

Entity Profile

Dependency Diagram

graph LR
  f1874e3c_f8f2_5f68_d3a9_0c56c0dad5ec["Types.ts"]
  e96f281e_f381_272d_2359_3e6a091c9a1d["CompilerError.ts"]
  f1874e3c_f8f2_5f68_d3a9_0c56c0dad5ec --> e96f281e_f381_272d_2359_3e6a091c9a1d
  e51fd0d2_bb38_cc97_7763_efe37f300a47["CompilerError"]
  f1874e3c_f8f2_5f68_d3a9_0c56c0dad5ec --> e51fd0d2_bb38_cc97_7763_efe37f300a47
  18a78965_f593_105b_e5e8_07001321c2ec["HIR.ts"]
  f1874e3c_f8f2_5f68_d3a9_0c56c0dad5ec --> 18a78965_f593_105b_e5e8_07001321c2ec
  866bf4af_e430_7559_4c79_09785f681ccb["PropertyLiteral"]
  f1874e3c_f8f2_5f68_d3a9_0c56c0dad5ec --> 866bf4af_e430_7559_4c79_09785f681ccb
  38c44267_cdd2_9815_ebad_fa6761ba5934["Globals.ts"]
  38c44267_cdd2_9815_ebad_fa6761ba5934 --> f1874e3c_f8f2_5f68_d3a9_0c56c0dad5ec
  18a78965_f593_105b_e5e8_07001321c2ec["HIR.ts"]
  18a78965_f593_105b_e5e8_07001321c2ec --> f1874e3c_f8f2_5f68_d3a9_0c56c0dad5ec
  58f81300_7c82_5086_3e10_e46b5f3ab04d["ObjectShape.ts"]
  58f81300_7c82_5086_3e10_e46b5f3ab04d --> f1874e3c_f8f2_5f68_d3a9_0c56c0dad5ec
  style f1874e3c_f8f2_5f68_d3a9_0c56c0dad5ec 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 {CompilerError} from '../CompilerError';
import {GeneratedSource, PropertyLiteral} from './HIR';

export type BuiltInType = PrimitiveType | FunctionType | ObjectType;

export type Type =
  | BuiltInType
  | PhiType
  | TypeVar
  | PolyType
  | PropType
  | ObjectMethod;
export type PrimitiveType = {kind: 'Primitive'};

/*
 * An {@link FunctionType} or {@link ObjectType} (also a JS object) may be associated with an
 * inferred "object shape", i.e. a known property (key -> Type) map. This is
 * subtly different from JS language semantics - `shape` represents both
 * OwnPropertyDescriptors and properties present in the prototype chain.
 *
 * {@link ObjectShape.functionType} is always present on the shape of a {@link FunctionType},
 * and it represents the call signature of the function. Note that Forget thinks of a
 * {@link FunctionType} as any "callable object" (not to be confused with objects that
 *   extend the global `Function`.)
 *
 * If `shapeId` is present, it is a key into the ShapeRegistry used to infer this
 * FunctionType or ObjectType instance (i.e. from an Environment).
 */

export type FunctionType = {
  kind: 'Function';
  shapeId: string | null;
  return: Type;
  isConstructor: boolean;
};

export type ObjectType = {
  kind: 'Object';
  shapeId: string | null;
};

export type TypeVar = {
  kind: 'Type';
  id: TypeId;
};
export type PolyType = {
  kind: 'Poly';
};
export type PhiType = {
  kind: 'Phi';
  operands: Array<Type>;
};
export type PropType = {
// ... (170 more lines)

Subdomains

Frequently Asked Questions

What does Types.ts do?
Types.ts is a source file in the react codebase, written in typescript. It belongs to the MIRInfrastructure domain, TypeInference subdomain.
What functions are defined in Types.ts?
Types.ts defines 13 function(s): duplicateType, funcTypeEquals, makeType, makeTypeId, objectMethodTypeEquals, objectTypeEquals, phiTypeEquals, polyTypeEquals, primitiveTypeEquals, propTypeEquals, and 3 more.
What does Types.ts depend on?
Types.ts imports 4 module(s): CompilerError, CompilerError.ts, HIR.ts, PropertyLiteral.
What files import Types.ts?
Types.ts is imported by 3 file(s): Globals.ts, HIR.ts, ObjectShape.ts.
Where is Types.ts in the architecture?
Types.ts is located at compiler/packages/babel-plugin-react-compiler/src/HIR/Types.ts (domain: MIRInfrastructure, subdomain: TypeInference, directory: compiler/packages/babel-plugin-react-compiler/src/HIR).

Analyze Your Own Codebase

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

Try Supermodel Free