Skip to content

Commit 6dc71bd

Browse files
fix: overload detection, ensure unnestoptions is properly captured
1 parent 23dd248 commit 6dc71bd

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

packages/firestore/lib/pipelines/pipeline_runtime.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -499,10 +499,20 @@ class RuntimePipelineImpl<T = DocumentData> implements RuntimePipeline {
499499
selectableOrOptions: Selectable | PipelineUnnestOptions,
500500
indexField?: string,
501501
): Pipeline<T> {
502-
if (
502+
const isOptionsObject =
503503
isRecord(selectableOrOptions) &&
504-
hasAnyKey(selectableOrOptions, ['selectable', 'indexField'])
505-
) {
504+
(Object.prototype.hasOwnProperty.call(selectableOrOptions, 'indexField') ||
505+
(Object.prototype.hasOwnProperty.call(selectableOrOptions, 'selectable') &&
506+
!hasAnyKey(selectableOrOptions, [
507+
'__kind',
508+
'exprType',
509+
'path',
510+
'name',
511+
'args',
512+
'alias',
513+
])));
514+
515+
if (isOptionsObject) {
506516
return this.append('unnest', selectableOrOptions as Record<string, unknown>);
507517
}
508518

0 commit comments

Comments
 (0)