Expected Behavior / Situation
Bucket<T> constructors should accept a default T. The ones without a default value should return Bucket<Partial<T>>
Actual Behavior / Situation
Existing bucket constructors don't accept a default value but return Bucket<T>
Modification Proposal
The type system is a bit too optimistic as T[K] might not hold any value yet (just initialised) or already (after calling remove). Making the output partial would bring it in line with reality.
If a meaningful default value available and provided for T it would allow to overcome the problem outlined above
Expected Behavior / Situation
Bucket<T>constructors should accept a defaultT. The ones without a default value should returnBucket<Partial<T>>Actual Behavior / Situation
Existing bucket constructors don't accept a default value but return
Bucket<T>Modification Proposal
The type system is a bit too optimistic as
T[K]might not hold any value yet (just initialised) or already (after callingremove). Making the output partial would bring it in line with reality.If a meaningful default value available and provided for
Tit would allow to overcome the problem outlined above