Just as with Map, knowing what type to expect from the WeakMap collection can be valuable. The key types are very slightly restricted, but still pretty loose, and there is no restriction on what type the values can be.
In this recipe, we'll take a look at how to create a wrapper class for WeakMap in order to control what types are used in the WeakMap.