Skip to content

Commit 7abede1

Browse files
committed
fixes
1 parent b544052 commit 7abede1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/schema/src/utils/typescript-expression-transformer.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,11 @@ export class TypeScriptExpressionTransformer {
375375
return match(expr.operator)
376376
.with('in', () => {
377377
const left = `${this.transform(expr.left, normalizeUndefined)}`;
378-
let result = `${this.transform(expr.right, false)}?.includes(${left})`;
378+
const right = `${this.transform(expr.right, false)}`;
379+
let result = `${right}?.includes(${left})`;
379380
if (this.options.context === ExpressionContext.ValidationRule) {
380381
// in a validation context, we treat binary involving undefined as boolean true
381-
result = this.ensureBooleanTernary(left, result);
382+
result = this.ensureBooleanTernary(left, this.ensureBooleanTernary(right, result));
382383
} else {
383384
result = this.ensureBoolean(result);
384385
}

0 commit comments

Comments
 (0)