ts-prims
Version:
Typescript Primitives
28 lines • 894 B
JavaScript
import { widthConstraint } from './width.js';
import { Prim } from './prim.js';
import { isInteger } from './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}
*/
export const Int = (w = 7) => Prim(`int<${w}>`, Number, [isInteger, widthConstraint(w)]);
/** Constructor for {@link int8} */
export const Int8 = Int(1);
/** Constructor for {@link int16} */
export const Int16 = Int(2);
/** Constructor for {@link int24} */
export const Int24 = Int(3);
/** Constructor for {@link int32} */
export const Int32 = Int(4);
/** Constructor for {@link int40} */
export const Int40 = Int(5);
/** Constructor for {@link int48} */
export const Int48 = Int(6);
/** Constructor for {@link int54} */
export const Int54 = Int(7);
//# sourceMappingURL=int.js.map