effect-io-ai

Package: effect
Module: Record

Record.ReadonlyRecord.IntersectKeys

Represents the intersection of two key types, handling both literal and non-literal string keys. This type is used in record operations that need to compute overlapping keys.

Example (Intersecting record keys)

import type { Record } from "effect"

// Intersection of literal keys
type Example1 = Record.ReadonlyRecord.IntersectKeys<"a" | "b", "b" | "c"> // "b"

// Intersection with generic string
type Example2 = Record.ReadonlyRecord.IntersectKeys<string, "a" | "b"> // string

Signature

type IntersectKeys<K1, K2> = [string] extends [K1 | K2] ?
    NonLiteralKey<K1> & NonLiteralKey<K2>
    : K1 & K2

Source

Since v2.0.0