import type { OptionalFromUndefined, SmartFlatten } from '../../object/index.js';
/** Is either a subtype of another one? */
export type IsRelated = A extends B ? T : B extends A ? T : F;
/** Extends 2-way */
export type IsCompatible = [A, B] extends [B, A] ? T : F;
/** Is (very) strictly equal https://stackoverflow.com/a/52473108/3570903 */
export type IsAlmostSame = (() => X extends B ? 1 : 0) extends () => X extends A ? 1 : 0 ? T : F;
export type IsIdenticalIfFunction = [A] extends [
(this: infer ThisA, ...args: any) => any
] ? [B] extends [(this: infer ThisB, ...args: any) => any] ? IsIdentical : true : true;
/** Extends 2-way, and is (very) strictly equal */
export type IsIdentical = [
IsCompatible
] extends [true] ? [IsAlmostSame] extends [true] ? [IsIdenticalIfFunction] extends [true] ? T : F : F : F;
/**
* Same as IsIdentical, but less strict for intersections:
*
* - `{a:1} & {b:1}` equals `{a:1; b:1}`
*
* Best of all, but complex
*/
export type IsEqual = IsIdentical, SmartFlatten, T, F>;
/**
* Same as `IsEqual`, but allows use of `undefined` and optional properties
* interchangeably
*/
export type IsNonStrictEqual = IsEqual, OptionalFromUndefined, T, F>;
//# sourceMappingURL=IsEqual.d.ts.map