1 | import { If, Not, And, Or } from 'typescript-logic';
|
2 | export declare type Extends<A, B> = Or<Any<B>, If<Any<A>, Any<B>, prv.Extends<A, B>>>;
|
3 | export declare type Compare<A, B, Options extends Compare.Options = Compare.Options.Default> = If<Extends<A, B>, If<Extends<B, A>, Options['equal' | 'broaderRight' | 'broaderLeft'], Options['broaderRight']>, If<Extends<B, A>, Options['broaderLeft'], Options['mismatch']>>;
|
4 | export declare namespace Compare {
|
5 | type Strict<A, B, Options extends Compare.Options = Compare.Options.Default> = If<Extends<A, B>, If<Extends<B, A>, Options['equal'], Options['broaderRight']>, If<Extends<B, A>, Options['broaderLeft'], Options['mismatch']>>;
|
6 | interface Options {
|
7 | broaderLeft: any;
|
8 | broaderRight: any;
|
9 | equal: any;
|
10 | mismatch: any;
|
11 | }
|
12 | namespace Options {
|
13 | interface Default extends Compare.Options {
|
14 | broaderLeft: 'broaderLeft';
|
15 | broaderRight: 'broaderRight';
|
16 | equal: 'equal';
|
17 | mismatch: 'mismatch';
|
18 | }
|
19 | }
|
20 | }
|
21 | export declare type Equal<A, B> = Or<And<Any<A>, Any<B>>, And<And<NotAny<A>, NotAny<B>>, And<Extends<A, B>, Extends<B, A>>>>;
|
22 | export declare type NotEqual<A, B> = Not<Equal<A, B>>;
|
23 | export declare type Any<Type> = And<prv.Extends<Type, 0>, prv.Extends<Type, 1>>;
|
24 | export declare type NotAny<Type, True = true, False = true> = Not<Any<Type>>;
|
25 | declare namespace prv {
|
26 | type Extends<A, B> = [A] extends [B] ? true : false;
|
27 | }
|
28 | export {};
|