type EqualsWrapped = T extends infer R & {} ? { [P in keyof R]: R[P] } : never declare const False: unique symbol declare const True: unique symbol /** * @tsplus type Check */ export type Check = [Condition] extends [never] ? Check.False : Check.True export declare namespace Check { /** * @tsplus type Check.True */ type True = typeof True /** * @tsplus type Check.False */ type False = typeof False /** * @tsplus type Check.Not */ type Not = [A] extends [never] ? unknown : never /** * @tsplus type Check.Extends */ type Extends = [A] extends [B] ? unknown : never /** * @tsplus type Check.IsUnion */ type IsUnion = [T] extends [TypeLevel.UnionToIntersection] ? never : unknown /** * @tsplus type Check.IsEqual */ type IsEqual = (() => T extends EqualsWrapped ? 1 : 2) extends < T >() => T extends EqualsWrapped ? 1 : 2 ? unknown : never /** * @tsplus type Check.IsLiteral */ type IsLiteral = Not< Extends | Extends > /** * @tsplus type Check.IsStruct */ type IsStruct = & Not> & Not> & IsEqual /** * @tsplus type Check.IsDictionary */ type IsDictionary = & IsEqual> & Extends & Not> /** * @tsplus type Check.IsRecord */ type IsRecord = & IsEqual> & IsUnion & Not> /** * @tsplus type Check.HaveSameLength */ type HaveSameLength = IsEqual< A["length"], B["length"] > /** * @tsplus type Check.IsTagged */ type IsTagged = & IsUnion & IsUnion & HaveSameLength, TypeLevel.UnionToTuple> }