/** * ref: * - https://stackoverflow.com/a/67655609/3068233 * - https://stackoverflow.com/a/73409753/3068233 */ type BuildArrayWith = TCurrent['length'] extends TLength ? TCheck extends 'len' ? [...TCurrent] : [...TCurrent, ...TType[]] : BuildArrayWith; /** * declares a type of array with a check on its length */ export type ArrayWith = BuildArrayWith; export {};