@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.
Matches a Single or a WeakSet or WeakMap (BUT unfortunately also Set & Map). So, it is BROKEN! Use
IsSingleOrWeakinstead that works fine!The following both fail, cause
WeakSet&WeakMapare not consideredSingletypes: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
WeakXxxtoSingle, it breaks to also matchSet&Map, which is awful! So we keep these off strictSingle.We can use
IsSingleOrWeaktill then.