Updates to WeakMap.

- Uses a generic class with the same signature as ts WeakMap.
- Complies with the return value from .set().