diff --git a/src/generic/arithmetic.ts b/src/generic/arithmetic.ts index 57bacad..5e6fc7e 100644 --- a/src/generic/arithmetic.ts +++ b/src/generic/arithmetic.ts @@ -21,7 +21,21 @@ console.log($contains!(searchItem, "erwin", "tj")); // OK, record the type of square: square.reflectedType = $$typeToString!(); -type Expand = T extends unknown ? { [K in keyof T]: T[K] } : never; -type Out = Expand>; +type ShallowExpand = T extends unknown ? { [K in keyof T]: T[K] } : never; +type ExpandedParameters any> = {[Index in keyof Parameters]: ShallowExpand[Index]>} +type ExpandTwice = {[Index in keyof T] : ShallowExpand} +type AsArray = T extends any[] ? T : []; +type DeepExpand = + T extends (...args: any) => any ? (...pars: AsArray>>) => DeepExpand> : + T extends unknown ? { [K in keyof T]: DeepExpand } : never; +type Out = ShallowExpand>; -console.log("Deps type is", $$typeToString!()) +console.log("Deps type is", $$typeToString!<() => Out>()) + +type OutB = ExpandTwice>; + +console.log("Or perhaps", $$typeToString!()) + +console.log("Or maybe even", $$typeToString!< + (...args: DeepExpand>>) => DeepExpand>> + >())