Gets the item type of an object that is possibly an array.
type ItemType<T extends Object> = T extends ReadonlyArray<any> ? T[number] : T[keyof T]