Result.ts — react Source File
Architecture documentation for Result.ts, a typescript file in the react codebase. 0 imports, 27 dependents.
Entity Profile
Dependency Diagram
graph LR 494e3425_0b47_293a_1ea4_d4670b0fc0e7["Result.ts"] e96f281e_f381_272d_2359_3e6a091c9a1d["CompilerError.ts"] e96f281e_f381_272d_2359_3e6a091c9a1d --> 494e3425_0b47_293a_1ea4_d4670b0fc0e7 2a7e50cd_6171_085d_277c_6ced6ddd7148["Imports.ts"] 2a7e50cd_6171_085d_277c_6ced6ddd7148 --> 494e3425_0b47_293a_1ea4_d4670b0fc0e7 9aa4477d_960b_1ea1_b6d9_36076aaa70bd["Program.ts"] 9aa4477d_960b_1ea1_b6d9_36076aaa70bd --> 494e3425_0b47_293a_1ea4_d4670b0fc0e7 e04c04d6_37a7_1dc3_7fae_7d07660d0af9["BuildHIR.ts"] e04c04d6_37a7_1dc3_7fae_7d07660d0af9 --> 494e3425_0b47_293a_1ea4_d4670b0fc0e7 1b971013_8a90_0d8d_1fcc_f31581cd66aa["Environment.ts"] 1b971013_8a90_0d8d_1fcc_f31581cd66aa --> 494e3425_0b47_293a_1ea4_d4670b0fc0e7 18a78965_f593_105b_e5e8_07001321c2ec["HIR.ts"] 18a78965_f593_105b_e5e8_07001321c2ec --> 494e3425_0b47_293a_1ea4_d4670b0fc0e7 4b3f307b_2e5b_6c5a_0729_065bd25db103["DropManualMemoization.ts"] 4b3f307b_2e5b_6c5a_0729_065bd25db103 --> 494e3425_0b47_293a_1ea4_d4670b0fc0e7 d24875c3_c045_4414_2cc9_16f96d59c629["InferMutationAliasingEffects.ts"] d24875c3_c045_4414_2cc9_16f96d59c629 --> 494e3425_0b47_293a_1ea4_d4670b0fc0e7 99c95040_9e14_265b_aae3_b58b12a70d8d["InferMutationAliasingRanges.ts"] 99c95040_9e14_265b_aae3_b58b12a70d8d --> 494e3425_0b47_293a_1ea4_d4670b0fc0e7 dc7f10c2_c914_a162_d02b_a10a15c64a5f["CodegenReactiveFunction.ts"] dc7f10c2_c914_a162_d02b_a10a15c64a5f --> 494e3425_0b47_293a_1ea4_d4670b0fc0e7 61433613_1614_4ece_2f7a_b0186e79adde["TestUtils.ts"] 61433613_1614_4ece_2f7a_b0186e79adde --> 494e3425_0b47_293a_1ea4_d4670b0fc0e7 fe7a7397_dddc_7222_20d4_d5b1015466f1["ValidateExhaustiveDependencies.ts"] fe7a7397_dddc_7222_20d4_d5b1015466f1 --> 494e3425_0b47_293a_1ea4_d4670b0fc0e7 0aa1377a_e69b_36ae_b83d_c842baa2ad42["ValidateHooksUsage.ts"] 0aa1377a_e69b_36ae_b83d_c842baa2ad42 --> 494e3425_0b47_293a_1ea4_d4670b0fc0e7 4f3dd743_0a09_5d8d_bf24_d727c39bc26f["ValidateMemoizedEffectDependencies.ts"] 4f3dd743_0a09_5d8d_bf24_d727c39bc26f --> 494e3425_0b47_293a_1ea4_d4670b0fc0e7 style 494e3425_0b47_293a_1ea4_d4670b0fc0e7 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.
*/
// Direct translation of Rust's Result type, although some ownership related methods are omitted.
export interface Result<T, E> {
/*
* Maps a `Result<T, E>` to `Result<U, E>` by applying a function to a contained `Ok` value,
* leaving an `Err` value untouched.
*
* This function can be used to compose the results of two functions.
*/
map<U>(fn: (val: T) => U): Result<U, E>;
/*
* Maps a `Result<T, E>` to `Result<T, F>` by applying a function to a contained `Err` value,
* leaving an `Ok` value untouched.
*
* This function can be used to pass through a successful result while handling an error.
*/
mapErr<F>(fn: (val: E) => F): Result<T, F>;
/*
* Returns the provided default (if `Err`), or applies a function to the contained value
* (if `Ok`).
*
* Arguments passed to {@link mapOr} are eagerly evaluated; if you are passing the result of a
* function call, it is recommended to use {@link mapOrElse}, which is lazily evaluated.
*/
mapOr<U>(fallback: U, fn: (val: T) => U): U;
/*
* Maps a `Result<T, E>` to `U` by applying fallback function default to a contained `Err` value,
* or function `fn` to a contained `Ok` value.
*
* This function can be used to unpack a successful result while handling an error.
*/
mapOrElse<U>(fallback: () => U, fn: (val: T) => U): U;
/*
* Calls `fn` if the result is `Ok`, otherwise returns the `Err` value of self.
*
* This function can be used for control flow based on Result values.
*/
andThen<U>(fn: (val: T) => Result<U, E>): Result<U, E>;
/*
* Returns res if the result is `Ok`, otherwise returns the `Err` value of self.
*
* Arguments passed to {@link and} are eagerly evaluated; if you are passing the result of a
* function call, it is recommended to use {@link andThen}, which is lazily evaluated.
*/
and<U>(res: Result<U, E>): Result<U, E>;
/*
* Returns `res` if the result is `Err`, otherwise returns the `Ok` value of self.
*
* Arguments passed to {@link or} are eagerly evaluated; if you are passing the result of a
* function call, it is recommended to use {@link orElse}, which is lazily evaluated.
*/
or(res: Result<T, E>): Result<T, E>;
/*
* Calls `fn` if the result is `Err`, otherwise returns the `Ok` value of self.
// ... (183 more lines)
Domain
Subdomains
Types
Imported By
- compiler/packages/babel-plugin-react-compiler/src/HIR/BuildHIR.ts
- compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts
- compiler/packages/babel-plugin-react-compiler/src/CompilerError.ts
- compiler/packages/babel-plugin-react-compiler/src/Inference/DropManualMemoization.ts
- compiler/packages/babel-plugin-react-compiler/src/HIR/Environment.ts
- compiler/packages/babel-plugin-react-compiler/src/HIR/HIR.ts
- compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Imports.ts
- compiler/packages/babel-plugin-react-compiler/src/Inference/InferMutationAliasingEffects.ts
- compiler/packages/babel-plugin-react-compiler/src/Inference/InferMutationAliasingRanges.ts
- compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Program.ts
- compiler/packages/babel-plugin-react-compiler/src/__tests__/Result-test.ts
- compiler/packages/babel-plugin-react-compiler/src/Utils/TestUtils.ts
- compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateExhaustiveDependencies.ts
- compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateHooksUsage.ts
- compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateMemoizedEffectDependencies.ts
- compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoCapitalizedCalls.ts
- compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoDerivedComputationsInEffects_exp.ts
- compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoFreezingKnownMutableFunctions.ts
- compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoImpureFunctionsInRender.ts
- compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoJSXInTryStatement.ts
- compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoRefAccessInRender.ts
- compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoSetStateInEffects.ts
- compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoSetStateInRender.ts
- compiler/packages/babel-plugin-react-compiler/src/Validation/ValidatePreservedManualMemoization.ts
- compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateSourceLocations.ts
- compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateStaticComponents.ts
- compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateUseMemo.ts
Source
Frequently Asked Questions
What does Result.ts do?
Result.ts is a source file in the react codebase, written in typescript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in Result.ts?
Result.ts defines 2 function(s): Err, Ok.
What files import Result.ts?
Result.ts is imported by 27 file(s): BuildHIR.ts, CodegenReactiveFunction.ts, CompilerError.ts, DropManualMemoization.ts, Environment.ts, HIR.ts, Imports.ts, InferMutationAliasingEffects.ts, and 19 more.
Where is Result.ts in the architecture?
Result.ts is located at compiler/packages/babel-plugin-react-compiler/src/Utils/Result.ts (domain: BabelCompiler, subdomain: Validation, directory: compiler/packages/babel-plugin-react-compiler/src/Utils).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free