DeepestListItemOrSelf<T>: T extends List<infer TItem> & object ? TItem extends List<any> & object ? any : TItem : T

unfortunately it's not possible to recursively collapse all possible list dimensions to T[] at this time, so give up after one dimension since that's likely the most common case '& object' prevents strings from being matched by list checks so types like string[] don't end up resulting in any

Type Parameters

  • T