Type Alias SingleOrWeak

SingleOrWeak: Single | WeakSet<any> | WeakMap<any, any>

Matches a Single or a WeakSet or WeakMap (BUT unfortunately also Set & Map). So, it is BROKEN! Use IsSingleOrWeak instead that works fine!

The following both fail, cause WeakSet & WeakMap are not considered Single types:

expectType<TypeOf<SingleOrWeak, Set>>(false) expectType<TypeOf<SingleOrWeak, Map<any, any>>>(false)

@todo(111): the following fails - find a better way export type SingleOrWeak = Single | Exclude<WeakSet | WeakMap<any, any>, Map<any, any> | Set>

Weak containers are a special case: they might have many nested items internally, but they are not iterable, hence practically they are not "Many" nor "Single" types either!

Note: another technical reason is that if we add WeakXxx to Single, it breaks to also match Set & Map, which is awful! So we keep these off strict Single.

We can use IsSingleOrWeak till then.