I'm struggling to define this specific type.
The goal is to create an open generic type ItemOrItemFactory<T>
that encompasses either T
or (..._: unknown[]) => T
.
Something along the lines of:
type ItemOrItemFactory = <T> T | ((..._: unknown[]) => T)
However, this syntax is not valid. I find it challenging to understand how generics operate with the type
keyword, and it's quite frustrating to search for solutions online.