KeyValueCombinerRepresents a bidirectional merge strategy for index signature key-value pairs.
Details
Used by IndexSignature when the same key appears multiple times
(e.g. from Schema.extend or overlapping records). Provides separate
decode and encode combiners that determine how duplicate entries are
merged.
export class class KeyValueCombinerclass KeyValueCombiner {
decode: Combiner.Combiner<readonly [key: PropertyKey, value: any]> | undefined;
encode: Combiner.Combiner<readonly [key: PropertyKey, value: any]> | undefined;
flip: () => KeyValueCombiner;
}
Represents a bidirectional merge strategy for index signature key-value pairs.
Details
Used by
IndexSignature
when the same key appears multiple times
(e.g. from Schema.extend or overlapping records). Provides separate
decode and encode combiners that determine how duplicate entries are
merged.
KeyValueCombiner {
readonly KeyValueCombiner.decode: Combiner.Combiner<readonly [key: PropertyKey, value: any]> | undefineddecode: import CombinerCombiner.interface Combiner<A>Represents a strategy for combining two values of the same type A. A
Combiner contains a single combine method that takes two values and
returns a merged result. It does not include an identity/empty value; use
Reducer when you need one.
When to use
Use when you need to describe how two values of the same type
merge, pass a reusable combining strategy to library functions like
Struct.makeCombiner or Option.makeCombinerFailFast, or define the
combining step for a Reducer.
Example (Combining numbers with addition)
import { Combiner } from "effect"
const Sum = Combiner.make<number>((self, that) => self + that)
console.log(Sum.combine(3, 4))
// Output: 7
Combiner<readonly [PropertyKeykey: type PropertyKey =
| string
| number
| symbol
PropertyKey, value: any]> | undefined
readonly KeyValueCombiner.encode: Combiner.Combiner<readonly [key: PropertyKey, value: any]> | undefinedencode: import CombinerCombiner.interface Combiner<A>Represents a strategy for combining two values of the same type A. A
Combiner contains a single combine method that takes two values and
returns a merged result. It does not include an identity/empty value; use
Reducer when you need one.
When to use
Use when you need to describe how two values of the same type
merge, pass a reusable combining strategy to library functions like
Struct.makeCombiner or Option.makeCombinerFailFast, or define the
combining step for a Reducer.
Example (Combining numbers with addition)
import { Combiner } from "effect"
const Sum = Combiner.make<number>((self, that) => self + that)
console.log(Sum.combine(3, 4))
// Output: 7
Combiner<readonly [PropertyKeykey: type PropertyKey =
| string
| number
| symbol
PropertyKey, value: any]> | undefined
constructor(
decode: | Combiner.Combiner<
readonly [key: PropertyKey, value: any]
>
| undefined
decode: import CombinerCombiner.interface Combiner<A>Represents a strategy for combining two values of the same type A. A
Combiner contains a single combine method that takes two values and
returns a merged result. It does not include an identity/empty value; use
Reducer when you need one.
When to use
Use when you need to describe how two values of the same type
merge, pass a reusable combining strategy to library functions like
Struct.makeCombiner or Option.makeCombinerFailFast, or define the
combining step for a Reducer.
Example (Combining numbers with addition)
import { Combiner } from "effect"
const Sum = Combiner.make<number>((self, that) => self + that)
console.log(Sum.combine(3, 4))
// Output: 7
Combiner<readonly [PropertyKeykey: type PropertyKey =
| string
| number
| symbol
PropertyKey, value: any]> | undefined,
encode: | Combiner.Combiner<
readonly [key: PropertyKey, value: any]
>
| undefined
encode: import CombinerCombiner.interface Combiner<A>Represents a strategy for combining two values of the same type A. A
Combiner contains a single combine method that takes two values and
returns a merged result. It does not include an identity/empty value; use
Reducer when you need one.
When to use
Use when you need to describe how two values of the same type
merge, pass a reusable combining strategy to library functions like
Struct.makeCombiner or Option.makeCombinerFailFast, or define the
combining step for a Reducer.
Example (Combining numbers with addition)
import { Combiner } from "effect"
const Sum = Combiner.make<number>((self, that) => self + that)
console.log(Sum.combine(3, 4))
// Output: 7
Combiner<readonly [PropertyKeykey: type PropertyKey =
| string
| number
| symbol
PropertyKey, value: any]> | undefined
) {
this.KeyValueCombiner.decode: Combiner.Combiner<readonly [key: PropertyKey, value: any]> | undefineddecode = decode: | Combiner.Combiner<
readonly [key: PropertyKey, value: any]
>
| undefined
decode
this.KeyValueCombiner.encode: Combiner.Combiner<readonly [key: PropertyKey, value: any]> | undefinedencode = encode: | Combiner.Combiner<
readonly [key: PropertyKey, value: any]
>
| undefined
encode
}
/** @internal */
KeyValueCombiner.flip(): KeyValueCombinerflip(): class KeyValueCombinerclass KeyValueCombiner {
decode: Combiner.Combiner<readonly [key: PropertyKey, value: any]> | undefined;
encode: Combiner.Combiner<readonly [key: PropertyKey, value: any]> | undefined;
flip: () => KeyValueCombiner;
}
Represents a bidirectional merge strategy for index signature key-value pairs.
Details
Used by
IndexSignature
when the same key appears multiple times
(e.g. from Schema.extend or overlapping records). Provides separate
decode and encode combiners that determine how duplicate entries are
merged.
KeyValueCombiner {
return new constructor KeyValueCombiner(decode: Combiner.Combiner<readonly [key: PropertyKey, value: any]> | undefined, encode: Combiner.Combiner<readonly [key: PropertyKey, value: any]> | undefined): KeyValueCombinerRepresents a bidirectional merge strategy for index signature key-value pairs.
Details
Used by
IndexSignature
when the same key appears multiple times
(e.g. from Schema.extend or overlapping records). Provides separate
decode and encode combiners that determine how duplicate entries are
merged.
KeyValueCombiner(this.KeyValueCombiner.encode: Combiner.Combiner<readonly [key: PropertyKey, value: any]> | undefinedencode, this.KeyValueCombiner.decode: Combiner.Combiner<readonly [key: PropertyKey, value: any]> | undefineddecode)
}
}