/** * Helper type to add two other types. * * From: https://gist.github.com/ryandabler/8b4ff4f36aed47bc09acc03174638468 */ export type Add = Length< [...BuildTuple, ...BuildTuple] >; /** * Helper type to subtract two other types. * * From: https://gist.github.com/ryandabler/8b4ff4f36aed47bc09acc03174638468 */ export type Subtract = A extends A ? BuildTuple extends [...infer U, ...BuildTuple] ? Length : never : never; type BuildTuple = T extends { length: L; } ? T : BuildTuple; type Length = T extends { length: infer L } ? L : never;