{
  "version": 3,
  "sources": ["../Source/HigherKind/index.ts", "../Source/HigherKind/HigherKind.Types.ts"],
  "sourcesContent": ["/**\n * Type utilities for defining and working with generic types.\n *\n * @module @sorrell/utilities/higher-kind\n * @experimental\n */\n/**\n * @file      index.ts\n * @author    Gage Sorrell <gage@sorrell.sh>\n * @copyright (c) 2026 Gage Sorrell\n * @license   MIT\n */\nexport * from \"./HigherKind.Types.ts\";\n", "/**\n * @file      HigherKind.Types.ts\n * @author    Gage Sorrell <gage@sorrell.sh>\n * @copyright (c) 2026 Gage Sorrell\n * @license   MIT\n */\nimport type { HigherArgumentVector } from \"../Tuple\";\n/** The type that all function types extend. */\nexport type AnyFunction = (...ArgumentVector: Array<never>) => unknown;\n/**\n * Define {@link https://en.wikipedia.org/wiki/Kind_(type_theory) | higher-kinded types }\n * by extending this class (see the example below).\n *\n * @template ArgumentVectorType - The `readonly` tuple-type that defines the type parameter\n * signature of the resulting generic type.  Please note that the `readonly` keyword *must*\n * be used when defining a higher-kind type with this.\n *\n * @example Map a tuple-type to a union of its element types.\n * ```typescript\n * interface TupleToUnion extends HigherKind<ReadonlyArray<unknown>>\n * {\n *     new: () => this[\"ArgumentVector\"][number];\n * }\n *\n * type A = Apply<TupleToUnion, [ string, number, boolean ]>;\n * //   ^? string | number | boolean\n * ```\n *\n * @example A constrained higher-kinded type.\n * ```typescript\n * interface FooWithNumberTail extends HigherKind<ReadonlyArray<number>>\n * {\n *     new: () => this[\"ArgumentVector\"];\n * }\n *\n * // \u2713 Good\n * type A = Apply<FooWithNumberTail, [ ]>;\n * //   ^? [ \"Foo\" ]\n *\n * // \u2713 Good\n * type B = Apply<FooWithNumberTail, [ 1, 2, 3 ]>;\n * //   ^? [ \"Foo\", 1, 2, 3 ]\n *\n * // (To define the constants below)\n * type C = Apply<FooWithNumberTail, [ number, number ]>;\n *\n * // \u2713 Good\n * const Bar: C = [ \"Foo\", 3, 2 ];\n * //    ^? [ \"Foo\", 3, 2 ]\n *\n * // \u2717 Bad\n * const Baz: C = [ \"Foo\", 3, 4, 5 ];\n * //                          ^^^ Error\n *\n * // \u2717 Bad\n * type D = Apply<FooWithNumberTail, [ 4, 5, 6, \"Bar\" ]>;\n * //                                         ^^^^^^^ Error\n * ```\n */\nexport abstract class HigherKind<ArgumentVectorType extends ReadonlyArray<unknown> = ReadonlyArray<unknown>> {\n    declare readonly ArgumentVector: ArgumentVectorType;\n    declare new: AnyFunction;\n}\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/**\n * Get the argument vector type of a given {@link HigherKind | higher-kinded type}.\n *\n *\n * @template HigherKindType - The {@link HigherKind | higher-kinded type} whose\n * argument vector type will be inferred.\n */\nexport type ArgumentsOf<HigherKindType extends HigherKind<any>> = HigherKindType extends HigherKind<infer OutType> ? OutType : never;\n/* eslint-enable @typescript-eslint/no-explicit-any */\nconst AssertTupleFailure: unique symbol = Symbol(\"__AssertTupleFailure__\");\nexport type AssertTuple<LeftType extends ReadonlyArray<unknown>, RightType extends ReadonlyArray<unknown>> = typeof AssertTupleFailure extends ({\n    [Index in number]: LeftType[Index] extends RightType[Index] ? LeftType[Index] : typeof AssertTupleFailure;\n}[number]) ? never : LeftType;\n/**\n * Define a type from a {@link HigherKind | higher-kinded type}, optionally\n * with a constrained {@link ArgumentVectorType}.\n *\n * @see {@link HigherKind}\n *\n * @template HigherKindType - The {@link | higher-kinded type} to apply.\n * @template ArgumentVectorType - The type parameter vector that is passed to\n * the given {@link HigherKindType}.\n */\nexport type Apply<HigherKindType extends HigherKind<ReadonlyArray<any>>, ArgumentVectorType extends ArgumentsOf<HigherKindType> = ArgumentsOf<HigherKindType>> = ReturnType<(HigherKindType & {\n    readonly ArgumentVector: ArgumentVectorType;\n})[\"new\"]>;\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC2DO,IAAe,aAAf,MAAsG;AAG7G;",
  "names": []
}
