@fibery/expression-utils 1.1.18 → 1.1.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -639,12 +639,15 @@ const getExpressionTypeInternal = ({
639
639
  typeObject,
640
640
  functionsMeta,
641
641
  onFieldNotFound,
642
- returnRefTypeInsteadOfId: firstLastFunctions.has(fnName) ? returnRefTypeInsteadOfId : false
642
+ returnRefTypeInsteadOfId: firstLastFunctions.has(fnName) || fnName === "q/if" ? returnRefTypeInsteadOfId : false
643
643
  }));
644
644
  if (firstLastFunctions.has(fnName)) {
645
645
  //assuming q/first has one argument and result type equals arg type.
646
646
  //we need this trick to support 'returnRefTypeInsteadOfId' behavior for q/first and q/last.
647
647
  result = argTypes[0];
648
+ } else if (fnName === "q/if") {
649
+ //we need this trick to support 'returnRefTypeInsteadOfId' behavior for q/if.
650
+ result = argTypes[1];
648
651
  } else {
649
652
  const overload = fnMeta.overloads.find(o => o["arg-types"].every((argType, index) => argTypes[index] === UNKNOWN_EXPRESSION_TYPE || argTypes[index] === argType));
650
653
  if (!overload) {
package/lib/visitors.js CHANGED
@@ -383,12 +383,15 @@ const getExpressionTypeInternal = ({
383
383
  typeObject,
384
384
  functionsMeta,
385
385
  onFieldNotFound,
386
- returnRefTypeInsteadOfId: firstLastFunctions.has(fnName) ? returnRefTypeInsteadOfId : false
386
+ returnRefTypeInsteadOfId: firstLastFunctions.has(fnName) || fnName === "q/if" ? returnRefTypeInsteadOfId : false
387
387
  }));
388
388
  if (firstLastFunctions.has(fnName)) {
389
389
  //assuming q/first has one argument and result type equals arg type.
390
390
  //we need this trick to support 'returnRefTypeInsteadOfId' behavior for q/first and q/last.
391
391
  result = argTypes[0];
392
+ } else if (fnName === "q/if") {
393
+ //we need this trick to support 'returnRefTypeInsteadOfId' behavior for q/if.
394
+ result = argTypes[1];
392
395
  } else {
393
396
  const overload = fnMeta.overloads.find(o => o["arg-types"].every((argType, index) => argTypes[index] === UNKNOWN_EXPRESSION_TYPE || argTypes[index] === argType));
394
397
  if (!overload) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fibery/expression-utils",
3
- "version": "1.1.18",
3
+ "version": "1.1.19",
4
4
  "description": "utils for working with fibery api expressions",
5
5
  "exports": {
6
6
  ".": "./lib/expression-utils.js",