ts-simple-ast
Version:
TypeScript compiler wrapper for static analysis and code manipulation.
20 lines (19 loc) • 1.01 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var errors = require("../../errors");
var FactoryStructurePrinter_1 = require("../FactoryStructurePrinter");
var JsxAttributeStructurePrinter = /** @class */ (function (_super) {
tslib_1.__extends(JsxAttributeStructurePrinter, _super);
function JsxAttributeStructurePrinter() {
return _super !== null && _super.apply(this, arguments) || this;
}
JsxAttributeStructurePrinter.prototype.printText = function (writer, structure) {
errors.throwIfTrue(structure.isSpreadAttribute, "Should not be a spread attribute when writing an attribute.");
writer.write(structure.name);
if (structure.initializer != null)
writer.write("=").write(structure.initializer);
};
return JsxAttributeStructurePrinter;
}(FactoryStructurePrinter_1.FactoryStructurePrinter));
exports.JsxAttributeStructurePrinter = JsxAttributeStructurePrinter;