I take the "forgetting" argument, but isn't coercion as simple as putting a "+" in front? Is there something about UNIX timestamps that makes them imprecise?
You’ll also need to do the inverse type conversion when pulling keys out of the map, say when using map.keys or map.entries, or when iterating over the map. The inverse here is new Date(key). Also, if you forget to coerce your key to a number when using map.get, it’s easy not to notice because the map won’t throw an error; it’ll simply return undefined.
Those are good points. As an aside, on a few occasions I've extended Map to a "StrictMap" which throws if .get() is called on a nonexistant key. It probably makes less sense in this case, but was a good DX improvement when working with configuration options in maps.
Thanks for pointing this out. The Inspector is trying to do this, which throws an error:
Object.getPrototypeOf(new Map()).size
I’ll see if I can fix that.