/** * This just pulls the "`I`" from a `Record` * * Had to create this utility since `keyof Record` doesn't seem to give I :/ */ export type InferRecordKey> = R extends Record ? K : never; /** * Executes an "array map" function on a tuple through a record * * For example: * * ```ts * Map = { [name in "arthur"|"jane"|"john"]: `hi ${name}!` } * Arr = [ "jane", "arthur" ] * * -> * * [ "hi jane!", "hi arthur!" ] * ``` */ export type MapArray = Arr extends readonly [ infer K extends keyof Map, ...infer Remaining extends (keyof Map)[] ] ? readonly [Map[K], ...MapArray] : readonly [];