#instanceof checks fail

1 messages · Page 1 of 1 (latest)

atomic coral
#

I've noticed sometimes with bun dev instanceof checks or symbol equality checks fail, almost as if the type is getting defined multiple times. Is there a workaround for this? Tried disabling hmr in case it was related but didn't seem to help.

echo mauve
#

instanceof checks for what specifically?

#

in general?

atomic coral
#

In this case I'm having right now, yjs is checking for YArray instanceof AbstractType, which it definitely is. Was working for weeks, and then just stopped working. Inspecting the type via devtools shows it clearly is an instance of AbstractType, but not the AbstractType that is in scope for some reason.

#

Seen similar issue where symbol checks failed and I had to compare symbol1.description == symbol2.description instead of symbol1 == symbol2 to get the check to pass when the code only defines the symbol once as a module level symbol.

echo mauve
#

hm

#

I did change a few things to how CommonJS <> ESM interop works

#

but that wouldn't cause symbol equality checks to fail because symbols are copied by value

#

this is more likely something where multiple copies of the code are loaded at once