import { prettify } from '..'; export type binaryMap = { 1: false; 0: unknown extends T ? true : false; }; type binaryCaseMap = { 1: 'type'; 0: 'else'; }; export type IsSuperTypeBinary = [B] extends [A] ? 1 : 0; export type IsSubTypeBinary = [A] extends [B] ? 1 : 0; export type IsAny = 0 extends (1 & T) ? 1 : 0; export type IsNever = [Type] extends [never] ? 1 : 0; export type IsUnknown = binaryMap[IsAny]; export type If = Condition[binaryCaseMap[Condition['condition']]]; export type IsStrictObject = IsAny extends 1 ? 0 : IsNever extends 1 ? 0 : [T] extends [unknownObject] ? 1 : 0; export interface XOR { 0: { 1: 1; 0: 0; }; 1: { 1: 0; 0: 1; }; } export interface AND { 0: { 1: 0; 0: 0; }; 1: { 1: 1; 0: 0; }; } export interface OR { 0: { 1: 1; 0: 0; }; 1: { 1: 1; 0: 1; }; } export interface toBoolean { 0: false; 1: true; } export type _EqualsObject<_A, _B, A = prettify<_A>, B = prettify<_B>> = (() => T extends A ? 1 : 2) extends (() => T extends B ? 1 : 2) ? true : false; export type _Equals, BIsAny extends 0 | 1 = IsAny> = If<{ condition: OR[AIsAny][BIsAny]; type: toBoolean[AND[AIsAny][BIsAny]]; else: If<{ condition: AND[IsStrictObject][IsStrictObject]; type: _EqualsObject; else: toBoolean[AND[IsSubTypeBinary][IsSuperTypeBinary]]; }>; }>; export {};