Removes small integer literals from an integer type enhanced with WithSmallInt. Useful for converting back to pure branded types.
Integer type with small literals to remove from
Maximum absolute value of literals to remove (default: 40)
The branded type without literal values
type Count = WithSmallInt<Uint>; // 0 | 1 | ... | 39 | Uinttype PureCount = RemoveSmallInt<Count>; // Uintconst toLargeCount = (n: Count): RemoveSmallInt<Count> => { if (typeof n === 'number') { return (n + 1000) as Uint; // Convert small to large } return n;}; Copy
type Count = WithSmallInt<Uint>; // 0 | 1 | ... | 39 | Uinttype PureCount = RemoveSmallInt<Count>; // Uintconst toLargeCount = (n: Count): RemoveSmallInt<Count> => { if (typeof n === 'number') { return (n + 1000) as Uint; // Convert small to large } return n;};
Removes small integer literals from an integer type enhanced with WithSmallInt. Useful for converting back to pure branded types.