type-plus
Version:
Provides additional types for TypeScript.
6 lines • 376 B
TypeScript
export type Bit = 0 | 1;
export type BitNot<X extends Bit> = X extends 0 ? 1 : 0;
export type BitAnd<A extends Bit, B extends Bit> = A extends 1 ? (B extends 1 ? 1 : 0) : 0;
export type BitOr<A extends Bit, B extends Bit> = A extends 1 ? 1 : B extends 1 ? 1 : 0;
export type BitXor<A extends Bit, B extends Bit> = A extends 1 ? BitNot<B> : B;
//# sourceMappingURL=Bit.d.ts.map