Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new Object().constructor === Object returns false #899

Open
fabian-hiller opened this issue May 27, 2024 · 2 comments
Open

new Object().constructor === Object returns false #899

fabian-hiller opened this issue May 27, 2024 · 2 comments

Comments

@fabian-hiller
Copy link

Bug Report

new Object().constructor === Object returns false in Next.js with edge runtime enabled.

A clear and concise description of the behavior.

new Object().constructor === Object should return true.

A clear and concise description of what you expected to happen (or code).

new Object().constructor === Object should return true

Workaround: new Object().constructor === Object.prototype.constructor

With other objects like Date it works: new Date().constructor === Date returns true

Steps to reproduce:

  1. Install Next.js
  2. Add export const runtime='edge' to page.tsx
  3. Add console.log(new Object().constructor === Object) to page.tsx
  4. Run next dev
@flostellbrink
Copy link

Just ran into this too. Easier reproduction:

npx edge-runtime --eval "({}).constructor == Object" -> false
node --eval "console.log(({}).constructor == Object)" -> true

@aldebout
Copy link

I think this is the root cause of this issue flightcontrolhq/superjson#302, would appreciate an answer from the maintainers :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants