Home / File/ edge-case-merge-uncond-optional-chain-and-cond.ts — react Source File

edge-case-merge-uncond-optional-chain-and-cond.ts — react Source File

Architecture documentation for edge-case-merge-uncond-optional-chain-and-cond.ts, a typescript file in the react codebase. 1 imports, 0 dependents.

File typescript TestingUtilities Fixtures 1 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  3620753d_bb64_f502_c9d4_8dca9addc61c["edge-case-merge-uncond-optional-chain-and-cond.ts"]
  006eec3d_77a9_4a47_e6c1_a96d7a6c9c05["shared-runtime"]
  3620753d_bb64_f502_c9d4_8dca9addc61c --> 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05
  style 3620753d_bb64_f502_c9d4_8dca9addc61c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import {identity} from 'shared-runtime';

/**
 * Evaluator failure:
 * Found differences in evaluator results
 *   Non-forget (expected):
 *   (kind: ok) {}
 *   [[ (exception in render) TypeError: Cannot read properties of null (reading 'title_text') ]]
 *   Forget:
 *   (kind: ok) {}
 *   {}
 */
/**
 * Very contrived text fixture showing that it's technically incorrect to merge
 * a conditional dependency (e.g. dep.path in `cond ? dep.path : ...`) and an
 * unconditionally evaluated optional chain (`dep?.path`).
 *
 *
 * when screen is non-null, useFoo returns { title: null } or "(not null)"
 * when screen is null, useFoo throws
 */
function useFoo({screen}: {screen: null | undefined | {title_text: null}}) {
  return screen?.title_text != null
    ? '(not null)'
    : identity({title: screen.title_text});
}
export const FIXTURE_ENTRYPOINT = {
  fn: useFoo,
  params: [{screen: null}],
  sequentialRenders: [{screen: {title_bar: undefined}}, {screen: null}],
};

Subdomains

Functions

Dependencies

  • shared-runtime

Frequently Asked Questions

What does edge-case-merge-uncond-optional-chain-and-cond.ts do?
edge-case-merge-uncond-optional-chain-and-cond.ts is a source file in the react codebase, written in typescript. It belongs to the TestingUtilities domain, Fixtures subdomain.
What functions are defined in edge-case-merge-uncond-optional-chain-and-cond.ts?
edge-case-merge-uncond-optional-chain-and-cond.ts defines 1 function(s): useFoo.
What does edge-case-merge-uncond-optional-chain-and-cond.ts depend on?
edge-case-merge-uncond-optional-chain-and-cond.ts imports 1 module(s): shared-runtime.
Where is edge-case-merge-uncond-optional-chain-and-cond.ts in the architecture?
edge-case-merge-uncond-optional-chain-and-cond.ts is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/edge-case-merge-uncond-optional-chain-and-cond.ts (domain: TestingUtilities, subdomain: Fixtures, directory: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps).

Analyze Your Own Codebase

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

Try Supermodel Free