Address build type errors for WeakMap