Collection of small TypeScript type utilities for boolean logic, set operations, tuples, objects, and higher-kinded type plumbing.
The list below assumes import type $ from '@escapace/typelevel' and names each utility by its full path from that import.
$.Assert.False<T>asserts thatTis exactly$.False.$.Assert.True<T>asserts thatTis exactly$.True.
$.Is.Any<T>returns$.TruewhenTisany.$.Is.Boolean<T>returns$.TruewhenTextendsboolean.$.Is.Falsy<T>returns$.Truefor JavaScript falsy types such as'',0,false,null,undefined, andvoid, and may return$.False | $.Truefor wider scalar types.$.Is.Never<T>returns$.TruewhenTisnever.$.Is.Number<T>returns$.TruewhenTextendsnumber.$.Is.Primitive<T>returns$.TruewhenTis anumber,boolean,string, orsymbol.$.Is.String<T>returns$.TruewhenTextendsstring.$.Is.Symbol<T>returns$.TruewhenTextendssymbol.$.Is.Truthy<T>returns the inverse of$.Is.Falsy<T>.$.Is.Unknown<T>returns$.TruewhenTisunknown.
$.To.Boolean<T>converts$.Falseor$.Truetofalseortrue.$.To.Intersection<U>converts a unionUinto an intersection.
$.And<A, B>returns$.Truewhen both operands are$.True.$.Equivalence<A, B>returns$.Truewhen both operands are equal.$.Falseis the type-level false value0.$.Implication<A, B>models logical implication and returns$.Falseonly whenAis$.TrueandBis$.False.$.Not<T>flips$.Falseto$.Trueand$.Trueto$.False.$.Or<A, B>returns$.Truewhen either operand is$.True.$.Trueis the type-level true value1.$.Xor<A, B>returns$.Truewhen exactly one operand is$.True.
$.Complement<A, B>returns the part of the universal setAthat is not in subsetB.$.Contains<A, B>returns$.TruewhenBis a subset ofA.$.Difference<A, B>returns the members ofAthat are not inB.$.Has<A, B>returns$.TruewhenAandBshare at least one member.$.Intersection<A, B>returns the members shared byAandB.$.SymmetricDifference<A, B>returns the members that appear in exactly one ofAorB.$.Union<A, B>returns the union ofAandB.
$.Argument<T, N>returns theNth argument type of functionTusing the library's one-based indexing scheme, where0resolves tonever.$.Arguments<T>returns the parameter tuple of functionT.
$.Append<A, B>addsAto the end of tupleB.$.Concat<A, B>concatenates tuplesAandB.$.Cons<A, B>is an alias of$.Prepend<A, B>.$.Drop<N, T>removes the firstNelements from tupleT.$.First<T, D>is an alias of$.Head<T, D>.$.Flatten<T>flattens a tuple of tuples by one level.$.Head<T, D>returns the first element of tupleT, orDwhenTis empty.$.Last<T>returns the last element of tupleT.$.List<A>is the base readonly list typereadonly A[].$.Prepend<A, B>addsAto the front of tupleB.$.Repeat<T, N>builds a tuple withTrepeatedNtimes.$.Reverse<L>reverses tupleL.$.Tail<L>returns every element of tupleLexcept the first.$.Take<N, T>returns the firstNelements of tupleT.$.Values<T>returns the union of the element types in an array-like typeT.$.Zip<A, B>pairs tuplesAandBelement by element until either tuple runs out.
$.Assign<T, U>merges object types and lets keys fromUoverwrite keys fromT.$.Omit<T, K>removes keysKfromT, distributing across unions.$.Prettify<T>remapsTto a plain object shape that is easier to inspect in editor tooltips.$.Properties<T, K, F>returns the value type for keyKinT, orFfor missing keys.
$.Cast<T, P>keepsTwhen it already extendsP; otherwise it falls back toP.$.Constructable<T>describes a constructor that producesT.$.Equal<A, B>returns$.TruewhenAandBare strictly equal types.$.Extends<V, T>returns$.TruewhenVextendsT.$.HKT<URI, A>is the base interface for unary higher-kinded types.$.HKT2<URI, L, A>is the base interface for binary higher-kinded types.$.HKT3<URI, U, L, A>is the base interface for ternary higher-kinded types.$.HKT4<URI, X, U, L, A>is the base interface for quaternary higher-kinded types.$.If<T, Then, Else>selectsThenfor$.TrueandElsefor$.False.$.NoInfer<T>preservesTwhile reducing inference from that position.$.Phantomis the unique symbol used as the placeholder key in the higher-kinded type registries.$.Type<URI, A>applies a registered unary higher-kinded type toA.$.Type2<URI, L, A>applies a registered binary higher-kinded type toLandA.$.Type3<URI, U, L, A>applies a registered ternary higher-kinded type toU,L, andA.$.Type4<URI, X, U, L, A>applies a registered quaternary higher-kinded type toX,U,L, andA.$.URI2HKT<A>is the augmentation point for unary higher-kinded type mappings.$.URI2HKT2<A, B>is the augmentation point for binary higher-kinded type mappings.$.URI2HKT3<A, B, C>is the augmentation point for ternary higher-kinded type mappings.$.URI2HKT4<A, B, C, D>is the augmentation point for quaternary higher-kinded type mappings.$.URISis the union of registered unary higher-kinded type identifiers.$.URIS2is the union of registered binary higher-kinded type identifiers.$.URIS3is the union of registered ternary higher-kinded type identifiers.$.URIS4is the union of registered quaternary higher-kinded type identifiers.$.Widen<T>widens boolean, number, and string literals to their scalar parent types.