Skip to content

Commit

Permalink
fix(types): allow arbitrary expressions for ConcatArrays
Browse files Browse the repository at this point in the history
Fix #12058
  • Loading branch information
vkarpov15 committed Jul 16, 2022
1 parent 4160245 commit 86f66b0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions test/types/expressions.test.ts
Expand Up @@ -203,3 +203,17 @@ const switchExpr: Expression.Switch = {
default: 'Hello'
}
};

(function gh12058() {
const concat: Expression.ConcatArrays = {
$concatArrays: [
{
$cond: {
if: { $eq: ['foo', true] },
then: [1],
else: [2]
}
}
]
};
})();
2 changes: 1 addition & 1 deletion types/expressions.d.ts
Expand Up @@ -1104,7 +1104,7 @@ declare module 'mongoose' {
* @version 3.2
* @see https://docs.mongodb.com/manual/reference/operator/aggregation/concatArrays/#mongodb-expression-exp.-concatArrays
*/
$concatArrays: ArrayExpression[];
$concatArrays: Expression[];
}

export interface Filter {
Expand Down

0 comments on commit 86f66b0

Please sign in to comment.