Skip to content

JS: non-constructor-methods should not create a new object #6926

@lpas

Description

@lpas
// this is ok
class OK {constructor() {}}
const ok = new OK()
console.log(new ok.constructor)

// should throw
class FAIL {m(){}}
const fail = new FAIL()
console.log(new fail.m)

// should throw
console.log(new ({ m() {}}).m)

We are currently printing for all 3 cases Object{}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghas reproWe have a way to reproduce this bug.js

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions