ts-odata-client
Version:
OData TypeScript Client
52 lines (51 loc) • 2.21 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.TypedExpression = exports.Expression = void 0;
var Literal_1 = require("./Literal");
/**
* Provides a way of expression operations that can be evaluated at run-time
*/
var Expression = /** @class */ (function () {
function Expression(operator, operands, previous) {
this.operator = operator;
this.operands = operands;
this.previous = previous;
}
/**
* Helper method to create a literal value with an optional type provided.
* @param value The literal value.
* @param literalType The type of the literal value (may be different than the runtime type given).
*/
Expression.literal = function (value, literalType) {
if (literalType === void 0) { literalType = typeof value; }
return new TypedExpression("literal" /* ExpressionOperator.Literal */, [new Literal_1.Literal(value, literalType)]);
};
return Expression;
}());
exports.Expression = Expression;
/**
* An @type {Expression} that indicates the type of the result. Primarily used for providing type checking for TypeScript.
*/
var TypedExpression = /** @class */ (function (_super) {
__extends(TypedExpression, _super);
function TypedExpression() {
return _super !== null && _super.apply(this, arguments) || this;
}
return TypedExpression;
}(Expression));
exports.TypedExpression = TypedExpression;