@rightcapital/phpdoc-parser
Version:
TypeScript version of PHPDoc parser with support for intersection types and generics
22 lines (21 loc) • 796 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConditionalTypeNode = void 0;
const type_node_1 = require("./type-node");
class ConditionalTypeNode extends type_node_1.TypeNode {
constructor(subjectType, targetType, ifType, elseType, negated) {
super();
this.subjectType = subjectType;
this.targetType = targetType;
this.ifType = ifType;
this.elseType = elseType;
this.negated = negated;
}
toString() {
return `(${this.subjectType.toString()} ${this.negated ? 'is not' : 'is'} ${this.targetType.toString()} ? ${this.ifType.toString()} : ${this.elseType.toString()})`;
}
getNodeType() {
return 'ConditionalTypeNode';
}
}
exports.ConditionalTypeNode = ConditionalTypeNode;