Type Alias IntersectKeysWithOr<T, KeyNames, F>

IntersectKeysWithOr: ResolveOrBlockEntityNames<T, F> extends infer OrNames
    ? ShouldNarrow<T, OrNames> extends true
        ? StrictNarrowByNames<T, Extract<KeyNames, OrNames & string>>
        : NarrowByNames<T, KeyNames>
    : NarrowByNames<T, KeyNames>

When top-level filter keys narrow to KeyNames, also checks if $or blocks narrow independently. Since DynamoDB ANDs top-level conditions with $or, a record must satisfy both — so the matching entities are the intersection.

  • If $or also narrows → intersect with KeyNames. Empty intersection → never[].
  • If $or does not narrow → use KeyNames alone.

Type Parameters

  • T extends default
  • KeyNames extends string
  • F