ts-prims
Version:
Typescript Primitives
32 lines • 1.22 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Int54 = exports.Int48 = exports.Int40 = exports.Int32 = exports.Int24 = exports.Int16 = exports.Int8 = exports.Int = void 0;
const width_js_1 = require("./width.js");
const prim_js_1 = require("./prim.js");
const varint_js_1 = require("./varint.js");
/**
* @template W The `Width`, inferred from parameter `w`.
*
* @param w The width of this type
* @returns The constructor for `int<W>`
*
* @see {@link int}
* @see {@link LowWidth}
*/
const Int = (w = 7) => (0, prim_js_1.Prim)(`int<${w}>`, Number, [varint_js_1.isInteger, (0, width_js_1.widthConstraint)(w)]);
exports.Int = Int;
/** Constructor for {@link int8} */
exports.Int8 = (0, exports.Int)(1);
/** Constructor for {@link int16} */
exports.Int16 = (0, exports.Int)(2);
/** Constructor for {@link int24} */
exports.Int24 = (0, exports.Int)(3);
/** Constructor for {@link int32} */
exports.Int32 = (0, exports.Int)(4);
/** Constructor for {@link int40} */
exports.Int40 = (0, exports.Int)(5);
/** Constructor for {@link int48} */
exports.Int48 = (0, exports.Int)(6);
/** Constructor for {@link int54} */
exports.Int54 = (0, exports.Int)(7);
//# sourceMappingURL=int.js.map