Hyperlinkv0.8.0-beta.28

Types

Types.MergeRighttypeeffect/Types.ts:405
MergeRight<Target, Source>

Right-biased merge of two object types where keys from Source take precedence over Target on conflict.

When to use

Use when you want right-biased merging where the second argument wins.

Details

The result is automatically simplified via Simplify.

Example (Right-biased merge)

import type { Types } from "effect"

type Result = Types.MergeRight<
  { a: number; b: number },
  { a: string; c: boolean }
>
// { a: string; b: number; c: boolean }
Source effect/Types.ts:4056 lines
export type MergeRight<Target, Source> = Simplify<
  & Source
  & {
    [Key in keyof Target as Key extends keyof Source ? never : Key]: Target[Key]
  }
>
Referenced by 1 symbols