Skip to content

Classes that extend Promise break instanceof #1925

@smikhalevski

Description

@smikhalevski

Describe the bug

Promise instances are treated as instances of any class that extends Promise.

Link to the blitz that caused the error

https://stackblitz.com/edit/stackblitz-starters-q5rlbxff?file=index.js

Steps to reproduce

class Xxx extends Promise {}

Promise.resolve() instanceof Xxx // true (but must be false)
Image

Expected behavior

A fresh install of Node.js v20.19.1 produces this result:

Image

Parity with Local

Screenshots

No response

Platform

Browser name  = Chrome
Full version  = 137.0.0.0
Major version = 137
navigator.appName = Netscape
navigator.userAgent = Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
performance.memory = {
  "totalJSHeapSize": 65797982,
  "usedJSHeapSize": 63431078,
  "jsHeapSizeLimit": 4294705152
}
Hash = 96435430

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions