PR #34 defines ReadonlyDeep as follows.
export type ReadonlyDeep<T> = T extends Primitive | ((...arguments: any[]) => unknown)
? T
: T extends ReadonlyMap<infer KeyType, infer ValueType>
? ReadonlyMapDeep<KeyType, ValueType>
: T extends ReadonlySet<infer ItemType>
? ReadonlySetDeep<ItemType>
: T extends object
? ReadonlyObjectDeep<T>
: unknown;
Is there any case in which a type would be mapped to "unknown"? Don't the queries cover all possible types? If so, can't the definition be simplified?
In the discussion which I linked to above, I suggested moving the Primitive test to the last clause. However, since then I was told that such an implementation is worth for typechecking performance, as every property will first be checked for all other types, and that those type queries aren't neglected in terms of performance. Out of these considerations, if Set and Map don't extend object, I suggest moving the object query above.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too