Skip to content

instanceof builtin checks fail for proxies using getPrototypeOf trap #25422

@Rich-Harris

Description

@Rich-Harris

What version of Bun is running?

1.3.1+89fa0f343

What platform is your computer?

Darwin 24.6.0 arm64 arm

What steps can reproduce the bug?

bun run the following:

class Foo {}

const proxy = new Proxy(new Foo(), {
	getPrototypeOf() {
		return File.prototype;
	}
});

console.log('proxy instanceof Foo', proxy instanceof Foo);
console.log('proxy instanceof File', proxy instanceof File);

What is the expected behavior?

It should log false then true, as happens in Node and other runtimes.

What do you see instead?

Instead, it logs false then false. It behaves correctly if instead of File you use some non-built-in class.

Additional information

ref sveltejs/kit#15018

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions